@sankhyalabs/sankhyablocks 8.16.0-dev.113 → 8.16.0-dev.114
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-df09fb78.js → ConfigStorage-48ba265b.js} +45 -17
- package/dist/cjs/{PersonalizedFilterUtils-0184ffbb.js → PersonalizedFilterUtils-7259cf65.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-45a8d7b7.js → SnkFormConfigManager-ce7b0951.js} +1 -1
- package/dist/cjs/{SnkMessageBuilder-9deeae08.js → SnkMessageBuilder-21cc7f09.js} +12 -1
- package/dist/cjs/default-filters-a09bf82b.js +8 -0
- package/dist/cjs/{filter-type.enum-b14ce507.js → filter-type.enum-2bb46d2a.js} +1 -0
- package/dist/cjs/{index-c5771aba.js → index-62760a9c.js} +5 -0
- package/dist/cjs/index-f9e81701.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_8.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-config-options_3.cjs.entry.js +2 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-57916de4.js → snk-data-unit-7913a033.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-default-filter.cjs.entry.js +77 -0
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-expression-group_2.cjs.entry.js +8 -6
- package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +4 -3
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +81 -27
- package/dist/cjs/snk-filter-detail.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
- package/dist/cjs/snk-grid.cjs.entry.js +1 -1
- package/dist/cjs/{snk-guides-viewer-d33379cd.js → snk-guides-viewer-450baf6a.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +51 -16
- package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +80 -12
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.css +34 -0
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.js +142 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +24 -15
- package/dist/collection/components/snk-filter-bar/types/default-filters.js +6 -0
- package/dist/collection/components/snk-filter-bar/types/filter-type.enum.js +1 -0
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +4 -4
- package/dist/collection/components/snk-personalized-filter/interfaces/index.js +5 -0
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +67 -13
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.css +3 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +20 -1
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +22 -3
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js +20 -1
- package/dist/collection/lib/configs/ConfigStorage.js +16 -8
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +29 -9
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +6 -0
- package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +6 -1
- package/dist/components/ConfigStorage.js +45 -17
- package/dist/components/PersonalizedFilterUtils.js +6 -1
- package/dist/components/SnkMessageBuilder.js +12 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-default-filter.d.ts +11 -0
- package/dist/components/snk-default-filter.js +6 -0
- package/dist/components/snk-default-filter2.js +97 -0
- package/dist/components/snk-expression-group2.js +4 -2
- package/dist/components/snk-expression-item2.js +5 -3
- package/dist/components/snk-filter-assistent-mode2.js +4 -2
- package/dist/components/snk-filter-bar2.js +28 -19
- package/dist/components/snk-filter-modal-item2.js +1 -0
- package/dist/components/snk-filter-modal.js +59 -8
- package/dist/components/snk-personalized-filter2.js +50 -14
- package/dist/esm/{ConfigStorage-71e6766f.js → ConfigStorage-79b9e180.js} +45 -17
- package/dist/esm/{PersonalizedFilterUtils-e2b38ef7.js → PersonalizedFilterUtils-2db38ff2.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-be490a33.js → SnkFormConfigManager-327dfdd4.js} +1 -1
- package/dist/esm/{SnkMessageBuilder-2dbd8fa2.js → SnkMessageBuilder-0f112c19.js} +12 -1
- package/dist/esm/default-filters-50105e43.js +8 -0
- package/dist/esm/{filter-type.enum-a80c1b6b.js → filter-type.enum-f6a8fe23.js} +1 -0
- package/dist/esm/{index-ae591a44.js → index-8acbae97.js} +6 -1
- package/dist/esm/index-a7d3d3f1.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_8.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-config-options_3.entry.js +2 -2
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-65c9dd1a.js → snk-data-unit-a95dc9fe.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-default-filter.entry.js +73 -0
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-expression-group_2.entry.js +8 -6
- package/dist/esm/snk-filter-advanced-mode_2.entry.js +4 -3
- package/dist/esm/snk-filter-bar_4.entry.js +81 -27
- package/dist/esm/snk-filter-detail.entry.js +2 -2
- package/dist/esm/snk-filter-field-search_2.entry.js +2 -2
- package/dist/esm/snk-filter-modal-item.entry.js +2 -2
- package/dist/esm/snk-grid.entry.js +1 -1
- package/dist/esm/{snk-guides-viewer-72953334.js → snk-guides-viewer-ebb40908.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-personalized-filter.entry.js +51 -16
- package/dist/esm/snk-simple-crud.entry.js +2 -2
- package/dist/sankhyablocks/{p-165cde3b.entry.js → p-043bef5f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ebdb9d89.js → p-088d7e7b.js} +1 -1
- package/dist/sankhyablocks/p-13a0ead0.entry.js +1 -0
- package/dist/sankhyablocks/{p-52d10014.entry.js → p-34f7a3ab.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ddf93f36.entry.js → p-39f3b02d.entry.js} +1 -1
- package/dist/sankhyablocks/p-5182513e.entry.js +1 -0
- package/dist/sankhyablocks/p-6416975c.js +56 -0
- package/dist/sankhyablocks/p-6a4b21dd.js +1 -0
- package/dist/sankhyablocks/{p-a4ebeec4.entry.js → p-6a5f061b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-54a5d52a.entry.js → p-70da6817.entry.js} +1 -1
- package/dist/sankhyablocks/{p-08ea6c86.entry.js → p-794840bd.entry.js} +1 -1
- package/dist/sankhyablocks/p-79b3cccc.js +1 -0
- package/dist/sankhyablocks/{p-bc101064.entry.js → p-7effe55f.entry.js} +1 -1
- package/dist/sankhyablocks/p-814d99ec.entry.js +1 -0
- package/dist/sankhyablocks/p-84345e7a.js +1 -0
- package/dist/sankhyablocks/{p-057fad05.js → p-988afe78.js} +1 -1
- package/dist/sankhyablocks/p-a9813a81.entry.js +1 -0
- package/dist/sankhyablocks/{p-3372178e.entry.js → p-ab12216c.entry.js} +1 -1
- package/dist/sankhyablocks/p-b568c1d4.js +1 -0
- package/dist/sankhyablocks/{p-c9675d64.js → p-bd6a6203.js} +1 -1
- package/dist/sankhyablocks/{p-7beeabc1.entry.js → p-bd7ccf60.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0fadb620.js → p-c7492861.js} +1 -1
- package/dist/sankhyablocks/p-d257ff20.entry.js +1 -0
- package/dist/sankhyablocks/{p-8002dcd0.entry.js → p-def1fe2d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5ffa0493.entry.js → p-e3c71e43.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b8d649dd.entry.js → p-e6d90f89.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +16 -4
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.d.ts +27 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -3
- package/dist/types/components/snk-filter-bar/types/default-filters.d.ts +5 -0
- package/dist/types/components/snk-filter-bar/types/filter-type.enum.d.ts +2 -1
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +3 -3
- package/dist/types/components/snk-personalized-filter/interfaces/index.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +7 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.d.ts +4 -0
- package/dist/types/components.d.ts +81 -6
- package/dist/types/lib/configs/ConfigStorage.d.ts +4 -2
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +8 -4
- 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-03b68a74.js +0 -56
- package/dist/sankhyablocks/p-3ab6df3d.entry.js +0 -1
- package/dist/sankhyablocks/p-4689c2e6.js +0 -1
- package/dist/sankhyablocks/p-490b75b5.entry.js +0 -1
- package/dist/sankhyablocks/p-60137b7a.entry.js +0 -1
- package/dist/sankhyablocks/p-933c0c0b.js +0 -1
- package/dist/sankhyablocks/p-9d3a025a.entry.js +0 -1
- package/dist/sankhyablocks/p-d9804798.js +0 -1
@@ -182,16 +182,30 @@ class GridConfigFetcher extends ResourceFetcher {
|
|
182
182
|
|
183
183
|
class PersonalizedFilterFetcher {
|
184
184
|
constructor() {
|
185
|
+
this.DEFAULT_RESOURCE = '_default';
|
185
186
|
this.templateByQuery = new Map();
|
186
187
|
this.buildTemplates();
|
187
188
|
}
|
188
|
-
resolveURI(resourceID, configName) {
|
189
|
+
resolveURI(resourceID, configName, isDefault) {
|
189
190
|
let uri = "filter-assistent-config://" + resourceID;
|
190
191
|
if (configName) {
|
191
192
|
uri += "." + configName;
|
192
193
|
}
|
194
|
+
if (isDefault) {
|
195
|
+
uri += this.DEFAULT_RESOURCE;
|
196
|
+
}
|
193
197
|
return uri;
|
194
198
|
}
|
199
|
+
resolveLegacyConfigName(legacyConfigName, isDefault) {
|
200
|
+
if (!legacyConfigName) {
|
201
|
+
return '';
|
202
|
+
}
|
203
|
+
let legacyConfig = `?legacyResourceID=${legacyConfigName}`;
|
204
|
+
if (isDefault) {
|
205
|
+
legacyConfig += this.DEFAULT_RESOURCE;
|
206
|
+
}
|
207
|
+
return legacyConfig;
|
208
|
+
}
|
195
209
|
buildTemplates() {
|
196
210
|
this.templateByQuery.set("fetchFilterFields", dist.gql `
|
197
211
|
query($name: String!) {
|
@@ -254,11 +268,14 @@ class PersonalizedFilterFetcher {
|
|
254
268
|
}
|
255
269
|
}`);
|
256
270
|
}
|
257
|
-
async
|
271
|
+
async loadDefaultFilter(resourceID, filterID, configName, legacyConfigName) {
|
272
|
+
return this.loadPersonalizedFilter(resourceID, filterID, configName, legacyConfigName, true);
|
273
|
+
}
|
274
|
+
async loadPersonalizedFilter(resourceID, filterID, configName, legacyConfigName, isDefault) {
|
258
275
|
return new Promise((resolve, reject) => {
|
259
276
|
DataFetcher.get()
|
260
277
|
.callGraphQL({
|
261
|
-
values: { name: this.resolveURI(resourceID, configName) + "/" + filterID + this.resolveLegacyConfigName(legacyConfigName) },
|
278
|
+
values: { name: this.resolveURI(resourceID, configName, isDefault) + "/" + filterID + this.resolveLegacyConfigName(legacyConfigName, isDefault) },
|
262
279
|
query: this.templateByQuery.get("fetchFilterAssistent"),
|
263
280
|
})
|
264
281
|
.then((resp) => {
|
@@ -270,10 +287,10 @@ class PersonalizedFilterFetcher {
|
|
270
287
|
});
|
271
288
|
});
|
272
289
|
}
|
273
|
-
|
274
|
-
return
|
290
|
+
async saveDefaultFilter(personalizedFilter, resourceID, configName) {
|
291
|
+
return this.savePersonalizedFilter(personalizedFilter, resourceID, configName, true);
|
275
292
|
}
|
276
|
-
async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
293
|
+
async savePersonalizedFilter(personalizedFilter, resourceID, configName, isDefault) {
|
277
294
|
if (!personalizedFilter || Object.keys(personalizedFilter).length == 0) {
|
278
295
|
return Promise.reject(new Error("personalizedFilter não pode ser vazio"));
|
279
296
|
}
|
@@ -282,7 +299,7 @@ class PersonalizedFilterFetcher {
|
|
282
299
|
return new Promise((resolve, reject) => {
|
283
300
|
DataFetcher.get()
|
284
301
|
.callGraphQL({
|
285
|
-
values: { name: this.resolveURI(resourceID, configName), filterAssistent: personalizedFilterParsed },
|
302
|
+
values: { name: this.resolveURI(resourceID, configName, isDefault), filterAssistent: personalizedFilterParsed },
|
286
303
|
query: this.templateByQuery.get("savePersonalizedFilter"),
|
287
304
|
})
|
288
305
|
.then((resp) => {
|
@@ -293,11 +310,14 @@ class PersonalizedFilterFetcher {
|
|
293
310
|
});
|
294
311
|
});
|
295
312
|
}
|
296
|
-
|
313
|
+
removeDefaultFilter(personalizedFilter, resourceID, configName) {
|
314
|
+
return this.removePersonalizedFilter(personalizedFilter, resourceID, configName, true);
|
315
|
+
}
|
316
|
+
async removePersonalizedFilter(personalizedFilter, resourceID, configName, isDefault) {
|
297
317
|
return new Promise((resolve, reject) => {
|
298
318
|
DataFetcher.get()
|
299
319
|
.callGraphQL({
|
300
|
-
values: { name: this.resolveURI(resourceID, configName), filterId: personalizedFilter.id },
|
320
|
+
values: { name: this.resolveURI(resourceID, configName, isDefault), filterId: personalizedFilter.id },
|
301
321
|
query: this.templateByQuery.get("deletePersonalizedFilter"),
|
302
322
|
})
|
303
323
|
.then((resp) => {
|
@@ -362,15 +382,15 @@ var CONFIG_SOURCE;
|
|
362
382
|
})(CONFIG_SOURCE || (CONFIG_SOURCE = {}));
|
363
383
|
class ConfigStorage {
|
364
384
|
static addFilterBarLegacyConfig(configName, legacyConfigName) {
|
365
|
-
this.
|
385
|
+
this.validateResourceId(legacyConfigName);
|
366
386
|
this.filterBarLegacyConfig.set(configName, legacyConfigName);
|
367
387
|
}
|
368
388
|
static addFormLegacyConfig(configName, legacyConfigName) {
|
369
|
-
this.
|
389
|
+
this.validateResourceId(legacyConfigName);
|
370
390
|
this.formLegacyConfig.set(configName, legacyConfigName);
|
371
391
|
}
|
372
392
|
static addGridLegacyConfig(configName, legacyConfigName) {
|
373
|
-
this.
|
393
|
+
this.validateResourceId(legacyConfigName);
|
374
394
|
this.gridLegacyConfig.set(configName, legacyConfigName);
|
375
395
|
}
|
376
396
|
static preload(resourceID, configName, legacyConfigs) {
|
@@ -427,6 +447,10 @@ class ConfigStorage {
|
|
427
447
|
await this.deleteGridConfigCache(name, resourceID);
|
428
448
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
429
449
|
}
|
450
|
+
static async loadDefaultFilter(filterId, resourceID, configName) {
|
451
|
+
const legacyConfigName = this.filterBarLegacyConfig.get(configName);
|
452
|
+
return this.personalizedFilterFetcher.loadDefaultFilter(resourceID, filterId, configName, legacyConfigName);
|
453
|
+
}
|
430
454
|
static async loadPersonalizedFilter(filterId, resourceID, configName) {
|
431
455
|
const legacyConfigName = this.filterBarLegacyConfig.get(configName);
|
432
456
|
return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName, legacyConfigName);
|
@@ -437,6 +461,13 @@ class ConfigStorage {
|
|
437
461
|
await this.deleteFilterBarConfigCache(configName, resourceID);
|
438
462
|
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
|
439
463
|
}
|
464
|
+
static async saveDefaultFilter(personalizedFilter, resourceID, configName) {
|
465
|
+
await this.deleteFilterBarConfigCache(configName, resourceID);
|
466
|
+
return this.personalizedFilterFetcher.saveDefaultFilter(personalizedFilter, resourceID, configName);
|
467
|
+
}
|
468
|
+
static async removeDefaultFilter(personalizedFilter, resourceID, configName) {
|
469
|
+
return this.personalizedFilterFetcher.removeDefaultFilter(personalizedFilter, resourceID, configName);
|
470
|
+
}
|
440
471
|
static async removePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
441
472
|
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
|
442
473
|
}
|
@@ -452,10 +483,8 @@ class ConfigStorage {
|
|
452
483
|
static async deleteFilterBarConfigCache(name, resourceID) {
|
453
484
|
await this.deleteConfigCache(name, resourceID, CONFIG_SOURCE.filterBar);
|
454
485
|
}
|
455
|
-
static
|
456
|
-
if (!
|
457
|
-
throw Error(this.CONFIG_NAME_ERROR_MESSAGE);
|
458
|
-
if (!legacyConfigName)
|
486
|
+
static validateResourceId(resourceId) {
|
487
|
+
if (!resourceId)
|
459
488
|
throw Error(this.LEGACY_CONFIG_NAME_ERROR_MESSAGE);
|
460
489
|
}
|
461
490
|
static handleLegacyConfig(configName, configSource, urlParams) {
|
@@ -495,7 +524,6 @@ class ConfigStorage {
|
|
495
524
|
return `req_${source}_${name}_${resourceID}`;
|
496
525
|
}
|
497
526
|
}
|
498
|
-
ConfigStorage.CONFIG_NAME_ERROR_MESSAGE = "ConfigName precisa ser informado.";
|
499
527
|
ConfigStorage.LEGACY_CONFIG_NAME_ERROR_MESSAGE = "LegacyConfigName precisa ser informado.";
|
500
528
|
ConfigStorage.filterBarLegacyConfig = new Map();
|
501
529
|
ConfigStorage.formLegacyConfig = new Map();
|
@@ -43,6 +43,11 @@ var FilterEntities;
|
|
43
43
|
FilterEntities["FIELD"] = "Campo";
|
44
44
|
FilterEntities["INSTANCE"] = "Instancia";
|
45
45
|
})(FilterEntities || (FilterEntities = {}));
|
46
|
+
var DefaultFilter;
|
47
|
+
(function (DefaultFilter) {
|
48
|
+
DefaultFilter["name"] = "Filtro padr\u00E3o";
|
49
|
+
DefaultFilter["id"] = "DEFAULT_FILTER";
|
50
|
+
})(DefaultFilter || (DefaultFilter = {}));
|
46
51
|
|
47
52
|
class PersonalizedFilterUtils {
|
48
53
|
/**
|
@@ -264,4 +269,4 @@ class PersonalizedFilterUtils {
|
|
264
269
|
}
|
265
270
|
}
|
266
271
|
|
267
|
-
export { FilterGroupCondition as F, PersonalizedFilterUtils as P, FilterOperand as a, FilterConfigType as b, FilterEntities as c, FilterUserConfigTypes as d };
|
272
|
+
export { DefaultFilter as D, FilterGroupCondition as F, PersonalizedFilterUtils as P, FilterOperand as a, FilterConfigType as b, FilterEntities as c, FilterUserConfigTypes as d };
|
@@ -83,6 +83,12 @@ const snkFilterBarMessages = {
|
|
83
83
|
"cancelButtonLabel": "Limpar tudo",
|
84
84
|
"customFilters": "Filtros personalizados",
|
85
85
|
"quickFilters": "Filtros rápidos",
|
86
|
+
"defaultFilter": {
|
87
|
+
"title": "Filtro padrão",
|
88
|
+
"edit": "Editar filtro",
|
89
|
+
"remove": "Excluir filtro",
|
90
|
+
"create": "Criar filtro padrão",
|
91
|
+
},
|
86
92
|
"validations": {
|
87
93
|
"notFullFilled": {
|
88
94
|
"title": "Filtro parcialmente preenchido",
|
@@ -395,6 +401,8 @@ const snkPersonalizedFilterMessages = {
|
|
395
401
|
info: {
|
396
402
|
titleEdit: "Editar filtro personalizado",
|
397
403
|
titleAdd: "Criar filtro personalizado",
|
404
|
+
titleCreateDefault: "Aplicar filtro padrão",
|
405
|
+
titleEditDefault: "Editar filtro padrão",
|
398
406
|
titleCollapsible: "Expressão a ser aplicada (gerada pelo assistente)",
|
399
407
|
labelSearchField: "Buscar campo",
|
400
408
|
labelOperator: "Operador",
|
@@ -417,7 +425,10 @@ const snkPersonalizedFilterMessages = {
|
|
417
425
|
applyExpression: "Expressão a ser aplicada:",
|
418
426
|
tooltipDisabledAssistentMode: "Expressão não suportada pelo assistente.",
|
419
427
|
activeModeAdvanced: "Ativar modo avançado",
|
420
|
-
activeModeAssistent: "Ativar modo assistente"
|
428
|
+
activeModeAssistent: "Ativar modo assistente",
|
429
|
+
textInputDisabled: "Campo desabilitado para filtros padrões",
|
430
|
+
checkVariableDisabled: "Filtro padrão não pode ser variável.",
|
431
|
+
deleteDefaultFilterConfirm: "Deseja excluir o <b>filtro padrão</b>?",
|
421
432
|
},
|
422
433
|
confirmExpression: {
|
423
434
|
title: "Aviso",
|
@@ -12,6 +12,7 @@ export { SnkCrud as SnkCrud } from '../types/components/snk-crud/snk-crud';
|
|
12
12
|
export { SnkCustomSlotElements as SnkCustomSlotElements } from '../types/components/snk-custom-slot-elements/snk-custom-slot-elements';
|
13
13
|
export { SnkDataExporter as SnkDataExporter } from '../types/components/snk-data-exporter/snk-data-exporter';
|
14
14
|
export { SnkDataUnit as SnkDataUnit } from '../types/components/snk-data-unit/snk-data-unit';
|
15
|
+
export { SnkDefaultFilter as SnkDefaultFilter } from '../types/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter';
|
15
16
|
export { SnkDetailView as SnkDetailView } from '../types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view';
|
16
17
|
export { SnkEntityList as SnkEntityList } from '../types/components/snk-entity-list/snk-entity-list';
|
17
18
|
export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender';
|
package/dist/components/index.js
CHANGED
@@ -12,6 +12,7 @@ export { SnkCrud, defineCustomElement as defineCustomElementSnkCrud } from './sn
|
|
12
12
|
export { SnkCustomSlotElements, defineCustomElement as defineCustomElementSnkCustomSlotElements } from './snk-custom-slot-elements.js';
|
13
13
|
export { SnkDataExporter, defineCustomElement as defineCustomElementSnkDataExporter } from './snk-data-exporter.js';
|
14
14
|
export { SnkDataUnit, defineCustomElement as defineCustomElementSnkDataUnit } from './snk-data-unit.js';
|
15
|
+
export { SnkDefaultFilter, defineCustomElement as defineCustomElementSnkDefaultFilter } from './snk-default-filter.js';
|
15
16
|
export { SnkDetailView, defineCustomElement as defineCustomElementSnkDetailView } from './snk-detail-view.js';
|
16
17
|
export { SnkEntityList, defineCustomElement as defineCustomElementSnkEntityList } from './snk-entity-list.js';
|
17
18
|
export { SnkExporterEmailSender, defineCustomElement as defineCustomElementSnkExporterEmailSender } from './snk-exporter-email-sender.js';
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
2
|
+
|
3
|
+
interface SnkDefaultFilter extends Components.SnkDefaultFilter, HTMLElement {}
|
4
|
+
export const SnkDefaultFilter: {
|
5
|
+
prototype: SnkDefaultFilter;
|
6
|
+
new (): SnkDefaultFilter;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Used to define this component and all nested components recursively.
|
10
|
+
*/
|
11
|
+
export const defineCustomElement: () => void;
|
@@ -0,0 +1,97 @@
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
+
|
3
|
+
var ActionDefaultFilter;
|
4
|
+
(function (ActionDefaultFilter) {
|
5
|
+
ActionDefaultFilter["EDIT"] = "edit";
|
6
|
+
ActionDefaultFilter["REMOVE"] = "remove";
|
7
|
+
ActionDefaultFilter["CREATE"] = "create";
|
8
|
+
})(ActionDefaultFilter || (ActionDefaultFilter = {}));
|
9
|
+
|
10
|
+
const snkDefaultFilterCss = ".sc-snk-default-filter-h{display:flex;justify-content:flex-end}.default_container.sc-snk-default-filter{border:none;background:none;display:flex;align-items:center;gap:var(--space--3xs, 4px);font-family:var(--font-pattern);color:var(--title--primary, #2b3a54);font-size:var(--text--medium, 14px);padding:0;outline:none}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter{cursor:pointer}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter:hover{color:var(--color--primary-600)}.new_filter.sc-snk-default-filter{cursor:pointer;margin:0 var(--space--3xs, 4px)}.new_filter.sc-snk-default-filter:hover{color:var(--color--primary-600)}";
|
11
|
+
|
12
|
+
const SnkDefaultFilter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
13
|
+
constructor() {
|
14
|
+
super();
|
15
|
+
this.__registerHost();
|
16
|
+
this.actionSelected = createEvent(this, "actionSelected", 7);
|
17
|
+
this.OFFSET_HEIGHT = 5;
|
18
|
+
this.getMessage = undefined;
|
19
|
+
this.hasDefaultFilter = false;
|
20
|
+
this._opened = false;
|
21
|
+
}
|
22
|
+
repositionDropDown() {
|
23
|
+
if (!this._refIcon || !this._refDropdown) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
const boundingIcon = this._refIcon.getBoundingClientRect();
|
27
|
+
const boundingDropDown = this._refDropdown.getBoundingClientRect();
|
28
|
+
this._refDropdown.style.top = (boundingIcon.y + boundingIcon.height + this.OFFSET_HEIGHT) + "px";
|
29
|
+
this._refDropdown.style.left = ((boundingIcon.x + (boundingIcon.width / 2)) - boundingDropDown.width) + "px";
|
30
|
+
}
|
31
|
+
toggleDropdown() {
|
32
|
+
this._opened = !this._opened;
|
33
|
+
}
|
34
|
+
closeDropdown(evt) {
|
35
|
+
const target = evt === null || evt === void 0 ? void 0 : evt.target;
|
36
|
+
if (!target) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
if (!target.closest("#dropdown-parent-demo")) {
|
40
|
+
this._opened = false;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
buildItems() {
|
44
|
+
return ([
|
45
|
+
{
|
46
|
+
id: ActionDefaultFilter.EDIT,
|
47
|
+
label: this.getMessage('defaultFilter.edit'),
|
48
|
+
},
|
49
|
+
{
|
50
|
+
id: ActionDefaultFilter.REMOVE,
|
51
|
+
label: this.getMessage('defaultFilter.remove'),
|
52
|
+
},
|
53
|
+
]);
|
54
|
+
}
|
55
|
+
onValueSelected({ detail: item }) {
|
56
|
+
this._opened = false;
|
57
|
+
this.actionSelected.emit(item.id);
|
58
|
+
}
|
59
|
+
openCreateNewFilter() {
|
60
|
+
this.actionSelected.emit(ActionDefaultFilter.CREATE);
|
61
|
+
}
|
62
|
+
componentDidRender() {
|
63
|
+
this.repositionDropDown();
|
64
|
+
}
|
65
|
+
componentWillLoad() {
|
66
|
+
this._items = this.buildItems();
|
67
|
+
document.removeEventListener("scroll", this.repositionDropDown.bind(this));
|
68
|
+
document.addEventListener("scroll", this.repositionDropDown.bind(this));
|
69
|
+
}
|
70
|
+
render() {
|
71
|
+
if (!this.hasDefaultFilter) {
|
72
|
+
return (h(Host, null, h("button", { class: "default_container new_filter", onClick: this.openCreateNewFilter.bind(this) }, h("span", null, this.getMessage('defaultFilter.create')))));
|
73
|
+
}
|
74
|
+
return (h(Host, null, h("button", { class: "default_container", onClick: this.toggleDropdown.bind(this) }, h("span", null, this.getMessage('defaultFilter.title')), h("ez-icon", { ref: (ref) => this._refIcon = ref, iconName: 'dots-vertical' })), this._opened &&
|
75
|
+
h("ez-dropdown", { ref: (ref) => this._refDropdown = ref, items: this._items, onEzClick: this.onValueSelected.bind(this), onEzOutsideClick: this.closeDropdown.bind(this) })));
|
76
|
+
}
|
77
|
+
static get style() { return snkDefaultFilterCss; }
|
78
|
+
}, [2, "snk-default-filter", {
|
79
|
+
"getMessage": [16],
|
80
|
+
"hasDefaultFilter": [4, "has-default-filter"],
|
81
|
+
"_opened": [32]
|
82
|
+
}]);
|
83
|
+
function defineCustomElement() {
|
84
|
+
if (typeof customElements === "undefined") {
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
const components = ["snk-default-filter"];
|
88
|
+
components.forEach(tagName => { switch (tagName) {
|
89
|
+
case "snk-default-filter":
|
90
|
+
if (!customElements.get(tagName)) {
|
91
|
+
customElements.define(tagName, SnkDefaultFilter);
|
92
|
+
}
|
93
|
+
break;
|
94
|
+
} });
|
95
|
+
}
|
96
|
+
|
97
|
+
export { ActionDefaultFilter as A, SnkDefaultFilter as S, defineCustomElement as d };
|
@@ -6,7 +6,7 @@ import { d as defineCustomElement$3 } from './snk-expression-item2.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './snk-filter-field-search2.js';
|
7
7
|
import { d as defineCustomElement$1 } from './snk-filter-param-config2.js';
|
8
8
|
|
9
|
-
const snkExpressionGroupCss = ".sc-snk-expression-group-h{display:block;--snk-expression-group--container-condition--width:184px;--snk-expression-group--container-condition--height:38px;--snk-expression-group--container-condition--border-radius:var(--border--radius-medium, 12px);--snk-expression-group--container-option--width:85px;--snk-expression-group__container-condition--background-and:#66B6A0;--snk-expression-group__container-condition--background-or:#EBC65E;--snk-expression-group__container-expression--padding-left:26px;--snk-expression-group__background-color-dashed:var(--background--body, #fafcff)}.snk-expression-group__container-condition.sc-snk-expression-group{width:var(--snk-expression-group--container-condition--width);height:var(--snk-expression-group--container-condition--height);border-radius:var(--snk-expression-group--container-condition--border-radius);z-index:var(--more-visible--2x, 3)}.snk-expression-group__container-option.sc-snk-expression-group{width:var(--snk-expression-group--container-option--width)}.snk-expression-group__container-condition[data-condition=\"AND\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-and)}.snk-expression-group__container-condition[data-condition=\"OR\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-or)}.snk-expression-group__container-expression.sc-snk-expression-group{padding-left:var(--snk-expression-group__container-expression--padding-left)}.dashes.sc-snk-expression-group{z-index:var(--visible, 1);background:var(--snk-expression-group__background-color-dashed);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:58px;margin-left:-15px;margin-top:-36.5px}.horizontal-dashes.sc-snk-expression-group{z-index:var(--more-visible, 2);border-bottom:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:54px;margin-left:-15px;margin-top:-33.5px}.hidden.sc-snk-expression-group{display:none}";
|
9
|
+
const snkExpressionGroupCss = ".sc-snk-expression-group-h{display:block;--snk-expression-group--container-condition--width:184px;--snk-expression-group--container-condition--height:38px;--snk-expression-group--container-condition--border-radius:var(--border--radius-medium, 12px);--snk-expression-group--container-option--width:85px;--snk-expression-group__container-condition--background-and:#66B6A0;--snk-expression-group__container-condition--background-or:#EBC65E;--snk-expression-group__container-expression--padding-left:26px;--snk-expression-group__background-color-dashed:var(--background--body, #fafcff);--ez-text-input__margin-bottom:0px}.snk-expression-group__container-condition.sc-snk-expression-group{width:var(--snk-expression-group--container-condition--width);height:var(--snk-expression-group--container-condition--height);border-radius:var(--snk-expression-group--container-condition--border-radius);z-index:var(--more-visible--2x, 3);padding:var(--space--nano, 2px)}.snk-expression-group__container-option.sc-snk-expression-group{width:var(--snk-expression-group--container-option--width)}.snk-expression-group__container-condition[data-condition=\"AND\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-and)}.snk-expression-group__container-condition[data-condition=\"OR\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-or)}.snk-expression-group__container-expression.sc-snk-expression-group{padding-left:var(--snk-expression-group__container-expression--padding-left)}.dashes.sc-snk-expression-group{z-index:var(--visible, 1);background:var(--snk-expression-group__background-color-dashed);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:58px;margin-left:-15px;margin-top:-36.5px}.horizontal-dashes.sc-snk-expression-group{z-index:var(--more-visible, 2);border-bottom:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:54px;margin-left:-15px;margin-top:-33.5px}.hidden.sc-snk-expression-group{display:none}";
|
10
10
|
|
11
11
|
const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
12
12
|
constructor() {
|
@@ -28,6 +28,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
28
28
|
this.messagesBuilder = undefined;
|
29
29
|
this.filterId = undefined;
|
30
30
|
this.entityURI = undefined;
|
31
|
+
this.isDefaultFilter = false;
|
31
32
|
}
|
32
33
|
/**
|
33
34
|
* Listener para capturar adição e remoção de grupos e items de expressão.
|
@@ -84,7 +85,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
84
85
|
}
|
85
86
|
renderExpressionItems() {
|
86
87
|
var _a;
|
87
|
-
return (_a = this._group.items) === null || _a === void 0 ? void 0 : _a.map((item) => (h("snk-expression-item", { key: item.id, class: "ez-padding-top--small snk-expression-group__item", expression: item, canRemove: this._group.items.length > 1, onEzFilterItemChange: () => this.handleFilterItemChange(), onEzFilterItemRemove: (evt) => this.handleFilterItemRemove(evt, item.id), messagesBuilder: this.messagesBuilder, entityURI: this.entityURI })));
|
88
|
+
return (_a = this._group.items) === null || _a === void 0 ? void 0 : _a.map((item) => (h("snk-expression-item", { key: item.id, class: "ez-padding-top--small snk-expression-group__item", expression: item, canRemove: this._group.items.length > 1, onEzFilterItemChange: () => this.handleFilterItemChange(), onEzFilterItemRemove: (evt) => this.handleFilterItemRemove(evt, item.id), messagesBuilder: this.messagesBuilder, entityURI: this.entityURI, isDefaultFilter: this.isDefaultFilter })));
|
88
89
|
}
|
89
90
|
renderGroups() {
|
90
91
|
var _a;
|
@@ -252,6 +253,7 @@ const SnkExpressionGroup = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
252
253
|
"messagesBuilder": [1040],
|
253
254
|
"filterId": [1025, "filter-id"],
|
254
255
|
"entityURI": [1025, "entity-u-r-i"],
|
256
|
+
"isDefaultFilter": [4, "is-default-filter"],
|
255
257
|
"_conditionOperator": [32],
|
256
258
|
"_group": [32],
|
257
259
|
"_selfTop": [32],
|
@@ -52,6 +52,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
52
52
|
this.expression = undefined;
|
53
53
|
this.canRemove = true;
|
54
54
|
this.messagesBuilder = undefined;
|
55
|
+
this.isDefaultFilter = false;
|
55
56
|
this.entityURI = undefined;
|
56
57
|
}
|
57
58
|
expressionChanged(newValue, oldValue) {
|
@@ -271,14 +272,14 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
271
272
|
return field;
|
272
273
|
}
|
273
274
|
setCriteriaSearch({ mode, argument }, application) {
|
274
|
-
var _a, _b;
|
275
|
+
var _a, _b, _c;
|
275
276
|
if (application == undefined)
|
276
277
|
return;
|
277
278
|
const searchOptions = {
|
278
279
|
showInactives: false
|
279
280
|
};
|
280
281
|
const options = {
|
281
|
-
entity: (_b = (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.ENTITYNAME,
|
282
|
+
entity: (_c = (_b = (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.ENTITYNAME) !== null && _c !== void 0 ? _c : this._fieldSelected.entityName,
|
282
283
|
searchOptions,
|
283
284
|
entityDescription: this._fieldSelected.description
|
284
285
|
};
|
@@ -289,7 +290,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
289
290
|
return (h(Host, null, h("div", { class: "dashes" }), h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", Object.assign({ ref: ref => this._elFilterInput = ref, value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `expressionFilterInput_${this.expression.fieldName || this.DEFAULT_FIELD_NAME}` })), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", Object.assign({ label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), value: this.expression.operand, canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => { var _a; return this.handleChangeOperator((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, suppressEmptyOption: true }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxOperand_${this.expression.fieldName || this.DEFAULT_FIELD_NAME}` }))), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
|
290
291
|
h("ez-number-input", { label: "Valor", canShowError: false, enabled: (!this._showValueVariable && !this._optionNotNull) }) :
|
291
292
|
this.buildFieldByType()), h("div", { class: "box__container--input-value-variable" }, !this._optionNotNull &&
|
292
|
-
h("ez-check", { ref: ref => this._elValueVariable = ref, value: this.expression.paramVariable, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail) }), (this._showValueVariable && !this._optionNotNull) &&
|
293
|
+
h("ez-tooltip", { message: this.getMessage("snkPersonalizedFilter.info.checkVariableDisabled"), active: this.isDefaultFilter }, h("ez-check", { ref: ref => this._elValueVariable = ref, value: this.expression.paramVariable, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail), enabled: !this.isDefaultFilter })), (this._showValueVariable && !this._optionNotNull) &&
|
293
294
|
h("ez-icon", Object.assign({ class: "box__container--input-value-variable--icon", size: "large", iconName: "settings-inverted" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: 'iconConfig' }, { title: this.getMessage("snkPersonalizedFilter.info.titleTooltip"), onClick: () => this.openSnkFilterParamConfig() })), h("snk-filter-param-config", { ref: (el) => this._elFilterParamConfigRef = el, messagesBuilder: this.messagesBuilder })), h("div", { class: "box__container--button-delete" }, h("div", { class: "box__container--button-delete--icon" }, h("ez-button", { mode: "icon", iconName: "delete", enabled: this.canRemove, label: this.getMessage("snkPersonalizedFilter.info.labelDeleteItem"), onClick: (evt) => this.confirmRemove(evt) })))))));
|
294
295
|
}
|
295
296
|
static get watchers() { return {
|
@@ -300,6 +301,7 @@ const SnkExpressionItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
300
301
|
"expression": [16],
|
301
302
|
"canRemove": [516, "can-remove"],
|
302
303
|
"messagesBuilder": [1040],
|
304
|
+
"isDefaultFilter": [4, "is-default-filter"],
|
303
305
|
"entityURI": [1025, "entity-u-r-i"],
|
304
306
|
"_showValueVariable": [32],
|
305
307
|
"_fieldSelected": [32],
|
@@ -17,6 +17,7 @@ const SnkFilterAssistentMode = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
17
17
|
this.filterId = undefined;
|
18
18
|
this.entityUri = undefined;
|
19
19
|
this.application = undefined;
|
20
|
+
this.isDefaultFilter = false;
|
20
21
|
}
|
21
22
|
getMessage(key, params) {
|
22
23
|
return this.application.messagesBuilder.getMessage(key, params);
|
@@ -30,7 +31,7 @@ const SnkFilterAssistentMode = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
30
31
|
}
|
31
32
|
render() {
|
32
33
|
var _a, _b;
|
33
|
-
return (h(Host, null, h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri })), h("div", { class: "ez-margin-top--auto" }, h("div", { class: "snk-personalized-filter__expression-input--line" }), h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, h("div", { class: "ez-box" }, h("div", { class: "ez-box__container--external" }, h("div", { class: "ez-box__container--internal" }, h("span", { class: "ez-box__container--title" }, this.getMessage("snkPersonalizedFilter.info.labelExpression")), h("span", { class: "ez-box__container--expression" }, (_b = this.filterAssistent) === null || _b === void 0 ? void 0 : _b.expression))))))));
|
34
|
+
return (h(Host, null, h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri, isDefaultFilter: this.isDefaultFilter })), h("div", { class: "ez-margin-top--auto" }, h("div", { class: "snk-personalized-filter__expression-input--line" }), h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, h("div", { class: "ez-box" }, h("div", { class: "ez-box__container--external" }, h("div", { class: "ez-box__container--internal" }, h("span", { class: "ez-box__container--title" }, this.getMessage("snkPersonalizedFilter.info.labelExpression")), h("span", { class: "ez-box__container--expression" }, (_b = this.filterAssistent) === null || _b === void 0 ? void 0 : _b.expression))))))));
|
34
35
|
}
|
35
36
|
static get style() { return snkFilterAssistentModeCss; }
|
36
37
|
}, [2, "snk-filter-assistent-mode", {
|
@@ -38,7 +39,8 @@ const SnkFilterAssistentMode = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
38
39
|
"messagesBuilder": [1040],
|
39
40
|
"filterId": [1025, "filter-id"],
|
40
41
|
"entityUri": [1025, "entity-uri"],
|
41
|
-
"application": [1040]
|
42
|
+
"application": [1040],
|
43
|
+
"isDefaultFilter": [4, "is-default-filter"]
|
42
44
|
}]);
|
43
45
|
function defineCustomElement() {
|
44
46
|
if (typeof customElements === "undefined") {
|
@@ -232,16 +232,16 @@ class SnkFilterModalFactory {
|
|
232
232
|
filterModal.getMessage = this._getMessage.bind(this);
|
233
233
|
filterModal.applyFilters = this.applyFilters.bind(this);
|
234
234
|
filterModal.closeModal = () => this._closeModal();
|
235
|
-
filterModal.addPersonalizedFilter = () => this._addPersonalizedFilterFn();
|
236
|
-
filterModal.editPersonalizedFilter = (id) => this._editPersonalizedFilterFn(id);
|
237
|
-
filterModal.deletePersonalizedFilter = (filter, configName) => this._onDeletePersonalizedFilter(filter, configName);
|
235
|
+
filterModal.addPersonalizedFilter = (isDefault) => this._addPersonalizedFilterFn(isDefault);
|
236
|
+
filterModal.editPersonalizedFilter = (id, isDefault) => this._editPersonalizedFilterFn(id, isDefault);
|
237
|
+
filterModal.deletePersonalizedFilter = (filter, configName, isDefault) => this._onDeletePersonalizedFilter(filter, configName, isDefault);
|
238
238
|
return filterModal;
|
239
239
|
}
|
240
240
|
async showModal() {
|
241
241
|
const filterModal = this.buildFilterModal();
|
242
242
|
const modalProps = {
|
243
243
|
content: filterModal,
|
244
|
-
position: '
|
244
|
+
position: 'right',
|
245
245
|
heightMode: 'full',
|
246
246
|
closeOutsideClick: false,
|
247
247
|
useScrimLight: true
|
@@ -265,6 +265,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
265
265
|
this._configUpdated = false;
|
266
266
|
this._firstLoad = true;
|
267
267
|
this._pendingVariables = false;
|
268
|
+
this._isDefaultFilter = false;
|
268
269
|
this._customfiltersToBeUpdated = [];
|
269
270
|
this._resolveLoading = undefined;
|
270
271
|
this._calculateSortIndex = (item) => {
|
@@ -497,10 +498,10 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
497
498
|
}
|
498
499
|
return this.filterActiveFilter(item) && (item.groupedItems || item.value != undefined);
|
499
500
|
}
|
500
|
-
registryFilterProvider() {
|
501
|
+
async registryFilterProvider() {
|
501
502
|
this.dataUnit.addFilterProvider(this);
|
502
503
|
if (this.filterConfig) {
|
503
|
-
this.doLoadData();
|
504
|
+
await this.doLoadData();
|
504
505
|
}
|
505
506
|
}
|
506
507
|
itemFocused(selectedItem) {
|
@@ -589,7 +590,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
589
590
|
this._application.isUserSup().then(value => this.allowDefault = value);
|
590
591
|
}
|
591
592
|
addFilterBarLegacyConfigName() {
|
592
|
-
if (this.filterBarLegacyConfigName
|
593
|
+
if (this.filterBarLegacyConfigName) {
|
593
594
|
ConfigStorage.addFilterBarLegacyConfig(this.configName, this.filterBarLegacyConfigName);
|
594
595
|
}
|
595
596
|
}
|
@@ -612,7 +613,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
612
613
|
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), e);
|
613
614
|
}
|
614
615
|
}
|
615
|
-
attachDataUnit() {
|
616
|
+
async attachDataUnit() {
|
616
617
|
if (this.dataUnit == undefined) {
|
617
618
|
let parent = this._element.parentElement;
|
618
619
|
while (parent) {
|
@@ -620,12 +621,12 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
620
621
|
const snkDataUnit = parent;
|
621
622
|
this.dataUnit = snkDataUnit.dataUnit;
|
622
623
|
if (this.dataUnit) {
|
623
|
-
this.registryFilterProvider();
|
624
|
+
await this.registryFilterProvider();
|
624
625
|
}
|
625
626
|
else {
|
626
|
-
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
627
|
+
snkDataUnit.addEventListener("dataUnitReady", async (evt) => {
|
627
628
|
this.dataUnit = evt.detail;
|
628
|
-
this.registryFilterProvider();
|
629
|
+
await this.registryFilterProvider();
|
629
630
|
});
|
630
631
|
}
|
631
632
|
break;
|
@@ -634,7 +635,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
634
635
|
parent = parent.parentElement;
|
635
636
|
}
|
636
637
|
else {
|
637
|
-
this.registryFilterProvider();
|
638
|
+
await this.registryFilterProvider();
|
638
639
|
}
|
639
640
|
}
|
640
641
|
/**
|
@@ -662,27 +663,34 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
662
663
|
onComplete: callbackOnApplyFilter,
|
663
664
|
disablePersonalizedFilter: this.disablePersonalizedFilter,
|
664
665
|
getMessage: (key, props) => this.getMessage(key, props),
|
665
|
-
onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
|
666
|
-
onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id),
|
667
|
-
onDeletePersonalizedFilter: (filter, configName) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName),
|
666
|
+
onAddPersonalizedFilter: (isDefault) => this.addPersonalizedFilter(isDefault),
|
667
|
+
onEditPersonalizedFilter: (id, isDefault) => this.editPersonalizedFilter(id, isDefault),
|
668
|
+
onDeletePersonalizedFilter: (filter, configName, isDefault) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName, isDefault),
|
668
669
|
};
|
669
670
|
this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
|
670
671
|
await this._filterModalFactory.showModal();
|
671
672
|
}
|
672
|
-
addPersonalizedFilter() {
|
673
|
+
addPersonalizedFilter(isDefault = false) {
|
673
674
|
this._filterModalFactory.closeModal();
|
675
|
+
this._isDefaultFilter = isDefault;
|
674
676
|
this.personalizedFilterId = undefined;
|
675
677
|
this.showPersonalizedFilter = true;
|
676
678
|
window.requestAnimationFrame(() => {
|
677
679
|
this._elPersonalizedFilter.createPersonalizedFilter();
|
678
680
|
});
|
679
681
|
}
|
680
|
-
editPersonalizedFilter(id) {
|
682
|
+
editPersonalizedFilter(id, isDefault = false) {
|
681
683
|
this._filterModalFactory.closeModal();
|
684
|
+
this._isDefaultFilter = isDefault;
|
682
685
|
this.showPersonalizedFilter = true;
|
683
686
|
this.personalizedFilterId = id;
|
684
687
|
}
|
685
|
-
deletePersonalizedFilter(filter, filterItemType, configName) {
|
688
|
+
deletePersonalizedFilter(filter, filterItemType, configName, isDefault = false) {
|
689
|
+
if (isDefault) {
|
690
|
+
ConfigStorage.removeDefaultFilter(filter, this.resourceID, configName);
|
691
|
+
this._isDefaultFilter = false;
|
692
|
+
return;
|
693
|
+
}
|
686
694
|
if (filterItemType === FilterItemType.PERSONALIZED) {
|
687
695
|
ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
|
688
696
|
}
|
@@ -700,6 +708,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
700
708
|
hidePersonalizedFilter() {
|
701
709
|
this.personalizedFilterId = undefined;
|
702
710
|
this.showPersonalizedFilter = false;
|
711
|
+
this._isDefaultFilter = false;
|
703
712
|
}
|
704
713
|
async componentWillLoad() {
|
705
714
|
var _a;
|
@@ -730,7 +739,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
730
739
|
return undefined;
|
731
740
|
}
|
732
741
|
if (this.showPersonalizedFilter) {
|
733
|
-
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
742
|
+
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, isDefaultFilter: this._isDefaultFilter, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
734
743
|
}
|
735
744
|
if (this.mode !== "regular") {
|
736
745
|
return (h(Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }))));
|
@@ -9,6 +9,7 @@ var FilterType;
|
|
9
9
|
FilterType["QUICK_FILTER"] = "QUICK_FILTER";
|
10
10
|
FilterType["CUSTOM_FILTER"] = "CUSTOM_FILTER";
|
11
11
|
FilterType["OTHER_FILTERS"] = "OTHER_FILTERS";
|
12
|
+
FilterType["DEFAULT_FILTER"] = "DEFAULT_FILTER";
|
12
13
|
})(FilterType || (FilterType = {}));
|
13
14
|
const FilterType$1 = FilterType;
|
14
15
|
|