@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-74224.0 → 0.0.0-bugfix-dev-KB-75070.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-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
- package/dist/cjs/{ContinuousInsertUtils-29b65619.js → ContinuousInsertUtils-64e47516.js} +29 -20
- package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-e059eb72.js} +7 -5
- package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-63369164.js} +2 -2
- package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-f89461c1.js → dataunit-fetcher-228016f4.js} +3 -3
- package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
- package/dist/cjs/index-f9e81701.js +8 -28
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-ca89181c.js → pesquisa-fetcher-a9bfeb22.js} +7 -2
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +6 -6
- package/dist/cjs/snk-application.cjs.entry.js +111 -59
- package/dist/cjs/snk-attach.cjs.entry.js +5 -5
- package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +365 -3
- package/dist/cjs/snk-crud.cjs.entry.js +13 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-668dc5e8.js → snk-data-unit-3d9b6ed4.js} +26 -14
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
- package/dist/cjs/{snk-filter-bar.cjs.entry.js → snk-filter-bar_4.cjs.entry.js} +691 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +16 -8
- package/dist/cjs/{snk-guides-viewer-4236cb9d.js → snk-guides-viewer-eee43c8b.js} +8 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +45 -10
- package/dist/cjs/snk-taskbar.cjs.entry.js +37 -35
- package/dist/collection/collection-manifest.json +11 -31
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +1 -1
- package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
- package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
- package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
- package/dist/collection/components/snk-application/snk-application.js +44 -54
- package/dist/collection/components/snk-crud/snk-crud.js +26 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +3 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +25 -13
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +18 -0
- package/dist/collection/components/snk-grid/snk-grid.js +28 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +57 -4
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +38 -36
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
- package/dist/collection/lib/utils/CrudUtils.js +25 -16
- package/dist/collection/sw.js +46 -0
- package/dist/components/ContinuousInsertUtils.js +25 -16
- package/dist/components/DataFetcher.js +7 -5
- package/dist/components/dataunit-fetcher.js +2 -2
- package/dist/components/pesquisa-fetcher.js +6 -1
- package/dist/components/snk-actions-button2.js +1 -1
- package/dist/components/snk-application2.js +107 -54
- package/dist/components/snk-crud.js +9 -2
- package/dist/components/snk-data-unit2.js +25 -13
- package/dist/components/snk-detail-view2.js +3 -0
- package/dist/components/snk-filter-bar2.js +4 -0
- package/dist/components/snk-grid2.js +11 -2
- package/dist/components/snk-simple-crud2.js +40 -4
- package/dist/components/snk-taskbar2.js +38 -36
- package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
- package/dist/esm/{ContinuousInsertUtils-30caa626.js → ContinuousInsertUtils-b62906f9.js} +29 -20
- package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
- package/dist/esm/{SnkFormConfigManager-139f09fa.js → SnkFormConfigManager-b409c745.js} +3 -3
- package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
- package/dist/esm/{constants-8457af36.js → constants-7302ee87.js} +1 -1
- package/dist/esm/{dataunit-fetcher-c24c76c6.js → dataunit-fetcher-56cb648b.js} +3 -3
- package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
- package/dist/esm/index-a7d3d3f1.js +8 -28
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-8edaa8cd.js → pesquisa-fetcher-6bc2e41a.js} +7 -2
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +7 -7
- package/dist/esm/snk-application.entry.js +111 -59
- package/dist/esm/snk-attach.entry.js +6 -6
- package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +366 -6
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +14 -8
- package/dist/esm/snk-data-exporter.entry.js +6 -6
- package/dist/esm/{snk-data-unit-0fdfb6c2.js → snk-data-unit-9fa7d2b9.js} +26 -14
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +8 -8
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/{snk-filter-bar.entry.js → snk-filter-bar_4.entry.js} +690 -5
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +16 -8
- package/dist/esm/{snk-guides-viewer-8934c537.js → snk-guides-viewer-e8ca764a.js} +9 -6
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +47 -12
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +38 -36
- package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
- package/dist/sankhyablocks/{p-b9c67e45.entry.js → p-0d2a2e9e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-afbb070d.js → p-0e206e62.js} +1 -1
- package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
- package/dist/sankhyablocks/p-200a5481.entry.js +11 -0
- package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-2d3f9482.entry.js} +1 -1
- package/dist/sankhyablocks/p-30ebcbe0.entry.js +1 -0
- package/dist/sankhyablocks/{p-1bf06cd3.js → p-341465ce.js} +2 -2
- package/dist/sankhyablocks/p-342eeb3b.js +1 -0
- package/dist/sankhyablocks/{p-7663f597.entry.js → p-41793e17.entry.js} +1 -1
- package/dist/sankhyablocks/p-42130213.entry.js +1 -0
- package/dist/sankhyablocks/{p-be5d8fcb.entry.js → p-43353d86.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7ac7932c.js → p-47d24ac8.js} +2 -2
- package/dist/sankhyablocks/p-520c7c38.entry.js +1 -0
- package/dist/sankhyablocks/{p-430e4d3c.entry.js → p-7075b789.entry.js} +1 -1
- package/dist/sankhyablocks/p-83e71703.entry.js +1 -0
- package/dist/sankhyablocks/{p-95df461f.entry.js → p-8b4fc28f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b0ef4383.js → p-95ce311a.js} +1 -1
- package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
- package/dist/sankhyablocks/{p-dcead955.entry.js → p-a2c790ac.entry.js} +1 -1
- package/dist/sankhyablocks/p-a3fadd0b.entry.js +1 -0
- package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
- package/dist/sankhyablocks/p-aaf94476.js +1 -0
- package/dist/sankhyablocks/p-ac26df7a.entry.js +1 -0
- package/dist/sankhyablocks/{p-4f35399c.entry.js → p-af7f7b3e.entry.js} +1 -1
- package/dist/sankhyablocks/p-c51ad0e7.entry.js +1 -0
- package/dist/sankhyablocks/{p-16869f77.js → p-e3a285a2.js} +1 -1
- package/dist/sankhyablocks/p-e4391e16.js +1 -0
- package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
- package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
- package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
- package/dist/types/components/snk-application/snk-application.d.ts +9 -13
- package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +2 -0
- package/dist/types/components.d.ts +30 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
- package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
- package/package.json +3 -2
- package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
- package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
- package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
- package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
- package/dist/cjs/snk-form.cjs.entry.js +0 -144
- package/dist/esm/snk-config-options.entry.js +0 -235
- package/dist/esm/snk-filter-item.entry.js +0 -308
- package/dist/esm/snk-filter-list.entry.js +0 -148
- package/dist/esm/snk-filter-modal.entry.js +0 -245
- package/dist/esm/snk-form.entry.js +0 -140
- package/dist/sankhyablocks/p-01086ff7.entry.js +0 -1
- package/dist/sankhyablocks/p-2923c1b5.js +0 -1
- package/dist/sankhyablocks/p-2aae03a1.entry.js +0 -1
- package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
- package/dist/sankhyablocks/p-5dd8cf4f.js +0 -1
- package/dist/sankhyablocks/p-60b29483.entry.js +0 -1
- package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
- package/dist/sankhyablocks/p-92eadb1c.entry.js +0 -1
- package/dist/sankhyablocks/p-a42e7a1e.entry.js +0 -11
- package/dist/sankhyablocks/p-a724e798.entry.js +0 -1
- package/dist/sankhyablocks/p-a75d242d.entry.js +0 -1
- package/dist/sankhyablocks/p-b9679243.entry.js +0 -1
- package/dist/sankhyablocks/p-ca5ec380.js +0 -1
- package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
- package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
- package/dist/sankhyablocks/p-feba9d4b.entry.js +0 -1
|
@@ -260,6 +260,10 @@ export namespace Components {
|
|
|
260
260
|
* Abre determinada tela, repassando pkObject.
|
|
261
261
|
*/
|
|
262
262
|
"openApp": (resourceId: string, pkObject: Object) => Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Remove registro do cache do PreLoader do dataunit. Deve ser usado quando existe um dataunit usando loader do application, mas o removeLoader está sendo sobrescrito.
|
|
265
|
+
*/
|
|
266
|
+
"preloadMangerRemoveRecord": (dataUnit: DataUnit, recordsIDs: Array<string>) => Promise<void>;
|
|
263
267
|
/**
|
|
264
268
|
* Remove um client event para o DataFetcher da aplicação.
|
|
265
269
|
* @param eventID - Nome do evento a ser removido.
|
|
@@ -464,6 +468,10 @@ export namespace Components {
|
|
|
464
468
|
* Ativa inserção de registros no modo grade.
|
|
465
469
|
*/
|
|
466
470
|
"enableGridInsert"?: boolean;
|
|
471
|
+
/**
|
|
472
|
+
* Ativa o gerenciamento de locks na grade.
|
|
473
|
+
*/
|
|
474
|
+
"enableLockManger"?: boolean;
|
|
467
475
|
/**
|
|
468
476
|
* Chave da configuração legado da barra de filtros.
|
|
469
477
|
*/
|
|
@@ -835,6 +843,10 @@ export namespace Components {
|
|
|
835
843
|
* @param filterItem - Item a ser adicionado, caso o item já exista com o ID ele não será adicionado novamente
|
|
836
844
|
*/
|
|
837
845
|
"addFilterItem": (filterItem: SnkFilterItemConfig) => Promise<void>;
|
|
846
|
+
/**
|
|
847
|
+
* Função chamada depois de aplicar os filtros.
|
|
848
|
+
*/
|
|
849
|
+
"afterFilterModalApply"?: () => void;
|
|
838
850
|
/**
|
|
839
851
|
* Define se a carga dos dados será feita assim que o componente for carregado.
|
|
840
852
|
*/
|
|
@@ -1352,6 +1364,10 @@ export namespace Components {
|
|
|
1352
1364
|
* Ativa inserção de registros no modo grade.
|
|
1353
1365
|
*/
|
|
1354
1366
|
"enableGridInsert"?: boolean;
|
|
1367
|
+
/**
|
|
1368
|
+
* Ativa o gerenciamento de locks na grade.
|
|
1369
|
+
*/
|
|
1370
|
+
"enableLockManger"?: boolean;
|
|
1355
1371
|
/**
|
|
1356
1372
|
* Chave da configuração legado da barra de filtros.
|
|
1357
1373
|
*/
|
|
@@ -1695,6 +1711,7 @@ export namespace Components {
|
|
|
1695
1711
|
* Ativa inserção de registros no modo grade.
|
|
1696
1712
|
*/
|
|
1697
1713
|
"enableGridInsert"?: boolean;
|
|
1714
|
+
"enableLockManger"?: boolean;
|
|
1698
1715
|
/**
|
|
1699
1716
|
* Define o nome da entidade que o componente vai utilizar para fazer as operações de CRUD
|
|
1700
1717
|
*/
|
|
@@ -2590,6 +2607,10 @@ declare namespace LocalJSX {
|
|
|
2590
2607
|
* Ativa inserção de registros no modo grade.
|
|
2591
2608
|
*/
|
|
2592
2609
|
"enableGridInsert"?: boolean;
|
|
2610
|
+
/**
|
|
2611
|
+
* Ativa o gerenciamento de locks na grade.
|
|
2612
|
+
*/
|
|
2613
|
+
"enableLockManger"?: boolean;
|
|
2593
2614
|
/**
|
|
2594
2615
|
* Chave da configuração legado da barra de filtros.
|
|
2595
2616
|
*/
|
|
@@ -2979,6 +3000,10 @@ declare namespace LocalJSX {
|
|
|
2979
3000
|
"onEzChangeFilter"?: (event: SnkFilterAssistentModeCustomEvent<IPersonalizedFilter>) => void;
|
|
2980
3001
|
}
|
|
2981
3002
|
interface SnkFilterBar {
|
|
3003
|
+
/**
|
|
3004
|
+
* Função chamada depois de aplicar os filtros.
|
|
3005
|
+
*/
|
|
3006
|
+
"afterFilterModalApply"?: () => void;
|
|
2982
3007
|
/**
|
|
2983
3008
|
* Define se a carga dos dados será feita assim que o componente for carregado.
|
|
2984
3009
|
*/
|
|
@@ -3465,6 +3490,10 @@ declare namespace LocalJSX {
|
|
|
3465
3490
|
* Ativa inserção de registros no modo grade.
|
|
3466
3491
|
*/
|
|
3467
3492
|
"enableGridInsert"?: boolean;
|
|
3493
|
+
/**
|
|
3494
|
+
* Ativa o gerenciamento de locks na grade.
|
|
3495
|
+
*/
|
|
3496
|
+
"enableLockManger"?: boolean;
|
|
3468
3497
|
/**
|
|
3469
3498
|
* Chave da configuração legado da barra de filtros.
|
|
3470
3499
|
*/
|
|
@@ -3779,6 +3808,7 @@ declare namespace LocalJSX {
|
|
|
3779
3808
|
* Ativa inserção de registros no modo grade.
|
|
3780
3809
|
*/
|
|
3781
3810
|
"enableGridInsert"?: boolean;
|
|
3811
|
+
"enableLockManger"?: boolean;
|
|
3782
3812
|
/**
|
|
3783
3813
|
* Define o nome da entidade que o componente vai utilizar para fazer as operações de CRUD
|
|
3784
3814
|
*/
|
|
@@ -5,5 +5,6 @@ export interface CrudFindResult {
|
|
|
5
5
|
}
|
|
6
6
|
export declare class CrudUtils {
|
|
7
7
|
static assertDefaultSorting(gridConfig: IGridConfig, dataUnit: DataUnit): void;
|
|
8
|
+
static parseCrudResults(entities: any, onlyFirst: boolean): CrudFindResult[] | CrudFindResult;
|
|
8
9
|
static find(entityName: string, fields: Array<string>, criteria: Map<string, string>, onlyFirst: boolean, criteriaExpression: string, orderBy: string): Promise<unknown>;
|
|
9
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sankhyalabs/sankhyablocks",
|
|
3
|
-
"version": "0.0.0-bugfix-dev-KB-
|
|
3
|
+
"version": "0.0.0-bugfix-dev-KB-75070.0",
|
|
4
4
|
"description": "Stencil Component Starter",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"jest-cli": "^27.4.5",
|
|
61
61
|
"jest-sonar-reporter": "^2.0.0",
|
|
62
62
|
"puppeteer": "^10.0.0",
|
|
63
|
-
"redux": "^4.1.2"
|
|
63
|
+
"redux": "^4.1.2",
|
|
64
|
+
"workbox-build": "^4.3.1"
|
|
64
65
|
},
|
|
65
66
|
"jest": {
|
|
66
67
|
"verbose": true,
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-f9e81701.js');
|
|
6
|
-
const core = require('@sankhyalabs/core');
|
|
7
|
-
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
|
8
|
-
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
|
-
const constants = require('./constants-35ddd366.js');
|
|
10
|
-
|
|
11
|
-
const snkConfigOptionsCss = ".sc-snk-config-options-h{--snk-config-options--border:2px solid var(--color--secondary-200, #D2D3DA);width:100%;border-radius:15px;border:var(--snk-config-options--border)}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";
|
|
12
|
-
|
|
13
|
-
const SnkConfigOptions = class {
|
|
14
|
-
constructor(hostRef) {
|
|
15
|
-
index.registerInstance(this, hostRef);
|
|
16
|
-
this.configOptionsChanged = index.createEvent(this, "configOptionsChanged", 7);
|
|
17
|
-
this._defaultType = undefined;
|
|
18
|
-
this.fieldConfig = {};
|
|
19
|
-
this.idConfig = undefined;
|
|
20
|
-
this.dataUnit = undefined;
|
|
21
|
-
this.messagesBuilder = undefined;
|
|
22
|
-
}
|
|
23
|
-
onConfigDefault(optionSelected) {
|
|
24
|
-
if (optionSelected != undefined) {
|
|
25
|
-
this._defaultType = optionSelected;
|
|
26
|
-
this.fieldConfig.defaultValue = {
|
|
27
|
-
type: this._defaultType
|
|
28
|
-
};
|
|
29
|
-
this.configOptionsChanged.emit(this.fieldConfig);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
buildOptions() {
|
|
33
|
-
var _a, _b, _c;
|
|
34
|
-
let interfaceField = (_c = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name)) === null || _c === void 0 ? void 0 : _c.userInterface;
|
|
35
|
-
if (interfaceField === core.UserInterface.SEARCH) {
|
|
36
|
-
interfaceField = core.UserInterface.INTEGERNUMBER;
|
|
37
|
-
}
|
|
38
|
-
return constants.VARS_BY_TYPE.UserInterface[interfaceField];
|
|
39
|
-
}
|
|
40
|
-
enabledValueDefault() {
|
|
41
|
-
var _a, _b, _c;
|
|
42
|
-
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
43
|
-
const allowDefault = (_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault;
|
|
44
|
-
const hasVariableVar = constants.VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface)
|
|
45
|
-
|| (field === null || field === void 0 ? void 0 : field.userInterface) === core.UserInterface.SEARCH;
|
|
46
|
-
if ((allowDefault == undefined || allowDefault === "true") && hasVariableVar) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
isAllowDefault() {
|
|
52
|
-
var _a, _b;
|
|
53
|
-
const allowDefault = (_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault;
|
|
54
|
-
if (allowDefault == undefined) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
return allowDefault === "true";
|
|
58
|
-
}
|
|
59
|
-
loadDefaultValue() {
|
|
60
|
-
var _a;
|
|
61
|
-
if (this.fieldConfig == undefined) {
|
|
62
|
-
this._defaultType = constants.DEFAULT_TYPE.fixed;
|
|
63
|
-
this.fieldConfig = {
|
|
64
|
-
defaultValue: {
|
|
65
|
-
type: this._defaultType
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
else if (((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
|
|
70
|
-
this._defaultType = constants.DEFAULT_TYPE.fixed;
|
|
71
|
-
this.fieldConfig.defaultValue = {
|
|
72
|
-
type: this._defaultType
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
this._defaultType = this.fieldConfig.defaultValue.type;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
getFieldProperties(field) {
|
|
80
|
-
var _a;
|
|
81
|
-
if (field != undefined) {
|
|
82
|
-
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
getMessage(key, params) {
|
|
86
|
-
return this.messagesBuilder.getMessage(key, params);
|
|
87
|
-
}
|
|
88
|
-
getDefaultType() {
|
|
89
|
-
var _a;
|
|
90
|
-
return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : constants.DEFAULT_TYPE.fixed;
|
|
91
|
-
}
|
|
92
|
-
getEnabledByProperty(attribName, propertyName) {
|
|
93
|
-
const fieldDescriptor = this._fieldProperties;
|
|
94
|
-
if (fieldDescriptor == undefined) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
const fieldProperties = fieldDescriptor.properties || {};
|
|
98
|
-
return fieldProperties.hasOwnProperty(propertyName) ? fieldProperties[propertyName] !== "S" : fieldDescriptor[attribName] !== true;
|
|
99
|
-
}
|
|
100
|
-
getValueByProperty(property) {
|
|
101
|
-
const properties = this._fieldProperties;
|
|
102
|
-
if (properties != undefined && properties[property] === true) {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
return this.fieldConfig[property];
|
|
106
|
-
}
|
|
107
|
-
getValidatedValue(fieldValue) {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
if (fieldValue == undefined) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
113
|
-
const dataType = field === null || field === void 0 ? void 0 : field.dataType;
|
|
114
|
-
if (dataType == undefined) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const value = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) != undefined ? undefined :
|
|
118
|
-
dataType !== DataType.DataType.OBJECT && dataType !== DataType.DataType.DATE
|
|
119
|
-
&& typeof fieldValue === "object"
|
|
120
|
-
? fieldValue.value
|
|
121
|
-
: fieldValue;
|
|
122
|
-
return dataType === DataType.DataType.OBJECT ? JSON.stringify(value) : value;
|
|
123
|
-
}
|
|
124
|
-
buildInputDefault({ value, enabled, label, name, required, userInterface }, properties = undefined, mode = undefined) {
|
|
125
|
-
let options;
|
|
126
|
-
let precision = 0;
|
|
127
|
-
let prettyPrecision = 0;
|
|
128
|
-
const TagName = userInterface == undefined || constants.TAGS_BY_TYPE[userInterface] == undefined
|
|
129
|
-
? constants.TAGS_BY_TYPE.DEFAULT
|
|
130
|
-
: constants.TAGS_BY_TYPE[userInterface];
|
|
131
|
-
if (userInterface === core.UserInterface.OPTIONSELECTOR) {
|
|
132
|
-
const prop = properties === null || properties === void 0 ? void 0 : properties.options;
|
|
133
|
-
if (typeof prop === "string") {
|
|
134
|
-
const parsed = core.ObjectUtils.stringToObject(prop);
|
|
135
|
-
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
options = prop;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else if (userInterface === core.UserInterface.DECIMALNUMBER) {
|
|
142
|
-
precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
|
|
143
|
-
prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
|
|
144
|
-
}
|
|
145
|
-
return index.h(TagName, Object.assign({ value: value, enabled: enabled, label: label, "data-field-name": name, key: name, onEzChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail) }, (this.getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode))));
|
|
146
|
-
}
|
|
147
|
-
getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
|
|
148
|
-
switch (userInterface) {
|
|
149
|
-
case core.UserInterface.SEARCH:
|
|
150
|
-
return {
|
|
151
|
-
suppressEmptyOption: required,
|
|
152
|
-
optionLoader: (searchArgument) => this.onSearch(searchArgument)
|
|
153
|
-
};
|
|
154
|
-
case core.UserInterface.OPTIONSELECTOR:
|
|
155
|
-
return {
|
|
156
|
-
suppressEmptyOption: required,
|
|
157
|
-
options
|
|
158
|
-
};
|
|
159
|
-
case core.UserInterface.CHECKBOX:
|
|
160
|
-
case core.UserInterface.SWITCH:
|
|
161
|
-
return {
|
|
162
|
-
mode
|
|
163
|
-
};
|
|
164
|
-
case core.UserInterface.INTEGERNUMBER:
|
|
165
|
-
case core.UserInterface.DECIMALNUMBER:
|
|
166
|
-
return {
|
|
167
|
-
precision,
|
|
168
|
-
prettyPrecision,
|
|
169
|
-
onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
|
|
170
|
-
};
|
|
171
|
-
case core.UserInterface.DATE:
|
|
172
|
-
case core.UserInterface.DATETIME:
|
|
173
|
-
case core.UserInterface.TIME:
|
|
174
|
-
return {
|
|
175
|
-
onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
|
|
176
|
-
};
|
|
177
|
-
default:
|
|
178
|
-
return {};
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
onChange(fieldValue) {
|
|
182
|
-
this.fieldConfig.defaultValue.value = this.getValidatedValue(fieldValue);
|
|
183
|
-
this.configOptionsChanged.emit(this.fieldConfig);
|
|
184
|
-
}
|
|
185
|
-
onSearch(searchArgument) {
|
|
186
|
-
if (this._application != undefined && this.fieldConfig != undefined) {
|
|
187
|
-
return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
buildField(descriptor, config) {
|
|
191
|
-
const { name, label, readOnly, required, defaultValue } = config;
|
|
192
|
-
const { userInterface, properties } = descriptor;
|
|
193
|
-
const allowDefault = properties === null || properties === void 0 ? void 0 : properties.allowDefault;
|
|
194
|
-
let value;
|
|
195
|
-
let enabled = core.StringUtils.getBooleanValue(allowDefault, !readOnly);
|
|
196
|
-
if (userInterface === core.UserInterface.FILE) {
|
|
197
|
-
enabled = false;
|
|
198
|
-
}
|
|
199
|
-
if (enabled) {
|
|
200
|
-
value = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value;
|
|
201
|
-
if (value != undefined) {
|
|
202
|
-
value = DataType.getConvertedValue(descriptor === null || descriptor === void 0 ? void 0 : descriptor.dataType, value);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
const configField = { value, enabled, label, name, required, userInterface };
|
|
206
|
-
switch (userInterface) {
|
|
207
|
-
case core.UserInterface.SWITCH:
|
|
208
|
-
return this.buildInputDefault(configField, undefined, utils.CheckMode.SWITCH);
|
|
209
|
-
case core.UserInterface.CHECKBOX:
|
|
210
|
-
return this.buildInputDefault(configField, undefined, utils.CheckMode.REGULAR);
|
|
211
|
-
case core.UserInterface.OPTIONSELECTOR:
|
|
212
|
-
case core.UserInterface.DECIMALNUMBER:
|
|
213
|
-
return this.buildInputDefault(configField, properties);
|
|
214
|
-
default:
|
|
215
|
-
return this.buildInputDefault(configField);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
componentWillLoad() {
|
|
219
|
-
var _a;
|
|
220
|
-
this.loadDefaultValue();
|
|
221
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
222
|
-
this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
|
|
223
|
-
}
|
|
224
|
-
componentDidLoad() {
|
|
225
|
-
core.ElementIDUtils.addIDInfo(this._element, this.fieldConfig.name);
|
|
226
|
-
}
|
|
227
|
-
render() {
|
|
228
|
-
var _a, _b;
|
|
229
|
-
return (index.h(index.Host, null, index.h("div", { id: this.idConfig }, index.h("div", { class: "ez-row ez-padding--medium" }, index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-text-input", { label: this.getMessage("snkConfigOptions.label.nameField"), value: (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.label, onEzChange: (evt) => { this.fieldConfig.label = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.typeValueDefault"), suppressEmptyOption: true, enabled: this.enabledValueDefault(), onEzChange: (evt) => { var _a; return this.onConfigDefault((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, value: this.getDefaultType() }, index.h("option", { value: constants.DEFAULT_TYPE.fixed }, this.getMessage("snkConfigOptions.options.valueFixed")), index.h("option", { value: constants.DEFAULT_TYPE.variable }, this.getMessage("snkConfigOptions.options.variable")))), index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, this._defaultType === constants.DEFAULT_TYPE.variable ?
|
|
230
|
-
index.h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.isAllowDefault(), onEzChange: (evt) => { var _a; this.fieldConfig.defaultValue.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value; this.configOptionsChanged.emit(this.fieldConfig); }, value: this.fieldConfig.defaultValue.value, options: this.buildOptions() })
|
|
231
|
-
:
|
|
232
|
-
((_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.userInterface) &&
|
|
233
|
-
this.buildField(this._fieldProperties, this.fieldConfig))), index.h("div", { class: "ez-row ez-padding--medium config-options__switch-row" }, index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-check", { mode: utils.CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.clearDuplicate"), value: this.fieldConfig.cleanOnCopy, onEzChange: (evt) => { this.fieldConfig.cleanOnCopy = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-check", { mode: utils.CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.requiredField"), enabled: this.getEnabledByProperty("required", "systemRequired"), value: this.getValueByProperty("required"), onEzChange: (evt) => { this.fieldConfig.required = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), index.h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, index.h("ez-check", { mode: utils.CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.protectedField"), enabled: this.getEnabledByProperty("readOnly", "systemReadOnly"), value: this.getValueByProperty("readOnly"), onEzChange: (evt) => { this.fieldConfig.readOnly = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } }))))));
|
|
234
|
-
}
|
|
235
|
-
get _element() { return index.getElement(this); }
|
|
236
|
-
};
|
|
237
|
-
SnkConfigOptions.style = snkConfigOptionsCss;
|
|
238
|
-
|
|
239
|
-
exports.snk_config_options = SnkConfigOptions;
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-f9e81701.js');
|
|
6
|
-
const core = require('@sankhyalabs/core');
|
|
7
|
-
const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
|
|
8
|
-
const filterNumberVariation = require('./filterNumberVariation-d65332da.js');
|
|
9
|
-
|
|
10
|
-
const SnkFilterItem = class {
|
|
11
|
-
constructor(hostRef) {
|
|
12
|
-
index.registerInstance(this, hostRef);
|
|
13
|
-
this.visibleChanged = index.createEvent(this, "visibleChanged", 7);
|
|
14
|
-
this.filterChange = index.createEvent(this, "filterChange", 3);
|
|
15
|
-
this.innerClickCheck = (_floatingContainer, node) => {
|
|
16
|
-
if (node.id != core.FloatingManager.MODAL_ELEMENT_ID) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
this.detailIsVisible = false;
|
|
20
|
-
return false;
|
|
21
|
-
};
|
|
22
|
-
this.detailIsVisible = undefined;
|
|
23
|
-
this.config = undefined;
|
|
24
|
-
this.getMessage = undefined;
|
|
25
|
-
this.showChips = true;
|
|
26
|
-
}
|
|
27
|
-
observeDetailIsVisible(value) {
|
|
28
|
-
this.visibleChanged.emit(value);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Exibe os detalhes de um item da lista.
|
|
32
|
-
*/
|
|
33
|
-
async showUp(open = false) {
|
|
34
|
-
return new Promise(resolve => {
|
|
35
|
-
this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
|
|
36
|
-
if (open) {
|
|
37
|
-
this._closeCallback = resolve;
|
|
38
|
-
window.requestAnimationFrame(() => {
|
|
39
|
-
this._floatingID = core.FloatingManager.float(this._popover, this._popoverContainer, this.getFloatOptions());
|
|
40
|
-
this._popover.show();
|
|
41
|
-
this.detailIsVisible = true;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
updatePosition() {
|
|
47
|
-
if (this._floatingID == undefined) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
core.FloatingManager.updateFloatPosition(this._popover, this._popoverContainer, this.getFloatOptions());
|
|
51
|
-
}
|
|
52
|
-
getFloatOptions() {
|
|
53
|
-
return {
|
|
54
|
-
autoClose: true,
|
|
55
|
-
innerClickTest: this.innerClickCheck,
|
|
56
|
-
backClickListener: () => this.onDetailCloseCallback(),
|
|
57
|
-
left: this.getOffsetLeft(),
|
|
58
|
-
top: this.getOffsetTop(),
|
|
59
|
-
useOverlay: true,
|
|
60
|
-
overlayClassName: 'ez-scrim ez-scrim--light',
|
|
61
|
-
isFixed: true
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
getOffsetLeft() {
|
|
65
|
-
const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
|
|
66
|
-
const rect = this._filterItemElement.getBoundingClientRect();
|
|
67
|
-
// Width baseado no conteudo do snk-filter-detail. Nesse momento ele retorna 0px pois ainda não foi criado em tela.
|
|
68
|
-
const filterDetailWidth = 430;
|
|
69
|
-
const adjustRightPosition = filterDetailWidth - (document.body.clientWidth - rect.left);
|
|
70
|
-
return `calc(${rect.x}px + ${padding} - ${adjustRightPosition > 0 ? adjustRightPosition : 0}px)`;
|
|
71
|
-
}
|
|
72
|
-
getOffsetTop() {
|
|
73
|
-
const rect = this._filterItemElement.getBoundingClientRect();
|
|
74
|
-
return (rect.y + rect.height) + "px";
|
|
75
|
-
}
|
|
76
|
-
controlScrollPage() {
|
|
77
|
-
window.removeEventListener("scroll", this.updatePosition.bind(this));
|
|
78
|
-
window.addEventListener("scroll", this.updatePosition.bind(this));
|
|
79
|
-
}
|
|
80
|
-
getConfigChanges() {
|
|
81
|
-
var _a;
|
|
82
|
-
const configToBeCleared = this.config;
|
|
83
|
-
if (!!((_a = configToBeCleared.groupedItems) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
84
|
-
configToBeCleared.visible = false;
|
|
85
|
-
configToBeCleared.groupedItems = configToBeCleared.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false })));
|
|
86
|
-
}
|
|
87
|
-
const hasMultiValues = configToBeCleared.type === filterItemType_enum.FilterItemType.MULTI_LIST && Array.isArray(configToBeCleared.value);
|
|
88
|
-
const newValue = hasMultiValues ? configToBeCleared.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
|
|
89
|
-
return Object.assign(Object.assign({}, configToBeCleared), { value: newValue });
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Oculta os detalhes de um item da lista.
|
|
93
|
-
*/
|
|
94
|
-
async hideDetail() {
|
|
95
|
-
if (this.detailIsVisible) {
|
|
96
|
-
if (this._floatingID != undefined) {
|
|
97
|
-
core.FloatingManager.close(this._floatingID);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
onDetailCloseCallback() {
|
|
102
|
-
this._floatingID = undefined;
|
|
103
|
-
this.detailIsVisible = false;
|
|
104
|
-
if (this._closeCallback) {
|
|
105
|
-
this._closeCallback();
|
|
106
|
-
this._closeCallback = undefined;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
//---------------------------------------------
|
|
110
|
-
// Event handlers
|
|
111
|
-
//---------------------------------------------
|
|
112
|
-
clickListener(evt) {
|
|
113
|
-
if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
114
|
-
if (evt.target === this._rightIconElement && this.canClearFilter()) {
|
|
115
|
-
const configChanged = this.getConfigChanges();
|
|
116
|
-
this.filterChange.emit(configChanged);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
if (this.detailIsVisible) {
|
|
120
|
-
this.hideDetail();
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
this.showUp(true);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
evt.preventDefault();
|
|
127
|
-
evt.stopImmediatePropagation();
|
|
128
|
-
evt.stopPropagation();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
mouseDownListener(evt) {
|
|
132
|
-
if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
133
|
-
evt.preventDefault();
|
|
134
|
-
evt.stopImmediatePropagation();
|
|
135
|
-
evt.stopPropagation();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
getLabel(isTooltipLabel = false) {
|
|
139
|
-
var _a, _b;
|
|
140
|
-
const { type, value, label, props, groupedItems = [] } = this.config;
|
|
141
|
-
if (value || groupedItems.length) {
|
|
142
|
-
if (type === filterItemType_enum.FilterItemType.BINARY_SELECT) {
|
|
143
|
-
const [optOne, optTwo] = props.options;
|
|
144
|
-
const tooltip = this.getMessage('snkFilterBar.binarySelectTooltip');
|
|
145
|
-
if (optOne.name === value) {
|
|
146
|
-
return isTooltipLabel ? `${tooltip} ${String(optOne.label).toLowerCase()}` : optOne.label;
|
|
147
|
-
}
|
|
148
|
-
if (optTwo.name === value) {
|
|
149
|
-
return isTooltipLabel ? `${tooltip} ${String(optTwo.label).toLowerCase()}` : optTwo.label;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (type === filterItemType_enum.FilterItemType.MULTI_SELECT) {
|
|
153
|
-
const opt = props.options.find(opt => opt.value === value);
|
|
154
|
-
return `${label}: ${opt.label}`;
|
|
155
|
-
}
|
|
156
|
-
if (type === filterItemType_enum.FilterItemType.PERIOD) {
|
|
157
|
-
let { end, start } = value;
|
|
158
|
-
if (typeof end === "string") {
|
|
159
|
-
end = new Date(end);
|
|
160
|
-
end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
|
|
161
|
-
}
|
|
162
|
-
if (typeof start === "string") {
|
|
163
|
-
start = new Date(start);
|
|
164
|
-
start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
|
|
165
|
-
}
|
|
166
|
-
const dateFormater = new Intl.DateTimeFormat("pt-BR");
|
|
167
|
-
if (end && start) {
|
|
168
|
-
const isSameYear = start.getFullYear() === end.getFullYear();
|
|
169
|
-
const formatOptions = Object.assign({ day: '2-digit', month: '2-digit' }, ((!isSameYear || isTooltipLabel) && { year: '2-digit' }));
|
|
170
|
-
const startLabel = core.DateUtils.formatDate(start, formatOptions);
|
|
171
|
-
const endLabel = core.DateUtils.formatDate(end, formatOptions);
|
|
172
|
-
if (isTooltipLabel) {
|
|
173
|
-
return this.getMessage('snkFilterBar.fullPeriodTooltip', { LABEL: label, START_LABEL: startLabel, END_LABEL: endLabel });
|
|
174
|
-
}
|
|
175
|
-
return `${label}: ${startLabel} \u2192 ${endLabel}`;
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
if (start) {
|
|
179
|
-
return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${dateFormater.format(start)}`;
|
|
180
|
-
}
|
|
181
|
-
else if (end) {
|
|
182
|
-
return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${dateFormater.format(end)}`;
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
return label;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
if (type === filterItemType_enum.FilterItemType.SEARCH) {
|
|
190
|
-
return `${label}: ${value.value} - ${value.label}`;
|
|
191
|
-
}
|
|
192
|
-
if (type === filterItemType_enum.FilterItemType.PERSONALIZED) {
|
|
193
|
-
const activeCount = this.calculateActiveCount(groupedItems);
|
|
194
|
-
if (activeCount <= 0)
|
|
195
|
-
return label;
|
|
196
|
-
return `${label}: ${this.getMessage('snkFilterBar.personalizedCount', { activeCount })}`;
|
|
197
|
-
}
|
|
198
|
-
if (type === filterItemType_enum.FilterItemType.MULTI_LIST) {
|
|
199
|
-
const selectedOptions = ((_a = value.elements) !== null && _a !== void 0 ? _a : value).filter(item => item === null || item === void 0 ? void 0 : item.check);
|
|
200
|
-
return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
|
|
201
|
-
}
|
|
202
|
-
if (type === filterItemType_enum.FilterItemType.CHECK_BOX_LIST) {
|
|
203
|
-
const selectedValues = Object.entries(value !== null && value !== void 0 ? value : {})
|
|
204
|
-
.filter(([_, value]) => value === true)
|
|
205
|
-
.map(([key, _]) => key);
|
|
206
|
-
const options = (_b = props.options) !== null && _b !== void 0 ? _b : [];
|
|
207
|
-
const selectedOptions = options.filter(option => selectedValues.includes(option.name));
|
|
208
|
-
return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
|
|
209
|
-
}
|
|
210
|
-
if (type === filterItemType_enum.FilterItemType.NUMBER && props.variation === filterNumberVariation.FilterNumberVariation.INTERVAL) {
|
|
211
|
-
const { start, end } = value;
|
|
212
|
-
if (start && end) {
|
|
213
|
-
return this.getMessage('snkFilterBar.fullIntervalTooltip', { LABEL: label, START_LABEL: start, END_LABEL: end });
|
|
214
|
-
}
|
|
215
|
-
if (start) {
|
|
216
|
-
return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${Number(start)}`;
|
|
217
|
-
}
|
|
218
|
-
if (end) {
|
|
219
|
-
return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return `${label}: ${value}`;
|
|
223
|
-
}
|
|
224
|
-
return label;
|
|
225
|
-
}
|
|
226
|
-
getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel) {
|
|
227
|
-
const checkedAmount = selectedOptions.length;
|
|
228
|
-
if (checkedAmount === 0) {
|
|
229
|
-
return `${label}`;
|
|
230
|
-
}
|
|
231
|
-
if (checkedAmount > 1) {
|
|
232
|
-
if (isTooltipLabel) {
|
|
233
|
-
const selectedOptionsDescrptions = selectedOptions.map(item => item.label);
|
|
234
|
-
return `${label}: ${selectedOptionsDescrptions.join(',')}`;
|
|
235
|
-
}
|
|
236
|
-
return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
|
|
237
|
-
}
|
|
238
|
-
return `${label}: ${selectedOptions[0].label}`;
|
|
239
|
-
}
|
|
240
|
-
calculateActiveCount(groupedItems) {
|
|
241
|
-
return groupedItems.reduce((total, item) => {
|
|
242
|
-
if (!!item.visible)
|
|
243
|
-
return total + 1;
|
|
244
|
-
return total;
|
|
245
|
-
}, 0);
|
|
246
|
-
}
|
|
247
|
-
componentDidLoad() {
|
|
248
|
-
if (this._filterItemElement) {
|
|
249
|
-
core.ElementIDUtils.addIDInfo(this._filterItemElement);
|
|
250
|
-
this._idSnkFilterDetail = `filterDetail_${this.config.id}`;
|
|
251
|
-
}
|
|
252
|
-
this.controlScrollPage();
|
|
253
|
-
}
|
|
254
|
-
componentDidRender() {
|
|
255
|
-
if (this._floatingID == undefined) {
|
|
256
|
-
if (this._popover) {
|
|
257
|
-
this._popover.remove();
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Emitido quando o estado do filtro é alterado.
|
|
263
|
-
*/
|
|
264
|
-
filterChangeListener() {
|
|
265
|
-
this.hideDetail();
|
|
266
|
-
}
|
|
267
|
-
canClearFilter() {
|
|
268
|
-
const { value, groupedItems = [] } = this.config;
|
|
269
|
-
if (value != undefined && this.config.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
|
|
270
|
-
return value.some((item) => item.check);
|
|
271
|
-
}
|
|
272
|
-
return value !== undefined || groupedItems.some(item => item.visible);
|
|
273
|
-
}
|
|
274
|
-
getRightIconName() {
|
|
275
|
-
if (this.canClearFilter())
|
|
276
|
-
return "close";
|
|
277
|
-
return this.detailIsVisible ? "chevron-up" : "chevron-down";
|
|
278
|
-
}
|
|
279
|
-
getLeftIconName() {
|
|
280
|
-
switch (this.config.type) {
|
|
281
|
-
case filterItemType_enum.FilterItemType.PERIOD:
|
|
282
|
-
return "calendar";
|
|
283
|
-
case filterItemType_enum.FilterItemType.PERSONALIZED:
|
|
284
|
-
return "tune";
|
|
285
|
-
}
|
|
286
|
-
return undefined;
|
|
287
|
-
}
|
|
288
|
-
hasActiveElements(value) {
|
|
289
|
-
var _a, _b, _c;
|
|
290
|
-
return ((_c = (_b = ((_a = value === null || value === void 0 ? void 0 : value.elements) !== null && _a !== void 0 ? _a : value)) === null || _b === void 0 ? void 0 : _b.filter(val => val === null || val === void 0 ? void 0 : val.check)) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
|
291
|
-
}
|
|
292
|
-
hasActiveValue(config) {
|
|
293
|
-
return (config.type !== filterItemType_enum.FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
|
|
294
|
-
}
|
|
295
|
-
getEnabledChip() {
|
|
296
|
-
if (this.config.type === filterItemType_enum.FilterItemType.PERSONALIZED) {
|
|
297
|
-
const { groupedItems = [] } = this.config;
|
|
298
|
-
return groupedItems.some(item => item.visible);
|
|
299
|
-
}
|
|
300
|
-
return this.hasActiveValue(this.config);
|
|
301
|
-
}
|
|
302
|
-
render() {
|
|
303
|
-
const leftIcon = this.getLeftIconName();
|
|
304
|
-
return (index.h(index.Host, null, this.showChips && (index.h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon && (index.h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" })), index.h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" }))), index.h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, index.h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips }))));
|
|
305
|
-
}
|
|
306
|
-
get _filterItemElement() { return index.getElement(this); }
|
|
307
|
-
static get watchers() { return {
|
|
308
|
-
"detailIsVisible": ["observeDetailIsVisible"]
|
|
309
|
-
}; }
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
exports.snk_filter_item = SnkFilterItem;
|