@sankhyalabs/sankhyablocks 8.1.0-dev.10 → 8.1.0-dev.11
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-e32e1391.js → ConfigStorage-d688c739.js} +160 -47
- package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
- package/dist/cjs/{SnkFormConfigManager-5e61b0a9.js → SnkFormConfigManager-29b73c81.js} +18 -20
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +11 -8
- package/dist/cjs/snk-application.cjs.entry.js +42 -38
- package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
- package/dist/cjs/snk-crud.cjs.entry.js +16 -5
- package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
- package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-80a00ae4.js} +4 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +6 -6
- package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +11 -13
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -15
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -16
- package/dist/cjs/snk-form-config.cjs.entry.js +4 -14
- package/dist/cjs/snk-form.cjs.entry.js +9 -5
- package/dist/cjs/snk-grid-config.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +11 -14
- package/dist/cjs/{snk-guides-viewer-eb0a79a4.js → snk-guides-viewer-f67f9cea.js} +9 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -4
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +11 -13
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
- package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
- package/dist/collection/components/snk-application/snk-application.js +58 -65
- package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
- package/dist/collection/components/snk-crud/snk-crud.js +18 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +20 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +25 -28
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -4
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +2 -12
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +27 -11
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
- package/dist/collection/components/snk-form/snk-form.js +24 -2
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
- package/dist/collection/components/snk-grid/snk-grid.js +27 -12
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +19 -1
- package/dist/collection/lib/configs/ConfigStorage.js +33 -44
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
- package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
- package/dist/components/ConfigStorage.js +161 -48
- package/dist/components/ResourceIDUtils.js +10 -0
- package/dist/components/SnkFormConfigManager.js +17 -19
- package/dist/components/auth-fetcher.js +1 -1
- package/dist/components/form-config-fetcher.js +64 -2
- package/dist/components/snk-actions-button2.js +11 -8
- package/dist/components/snk-application2.js +42 -38
- package/dist/components/snk-configurator2.js +3 -1
- package/dist/components/snk-crud.js +17 -5
- package/dist/components/snk-data-unit2.js +5 -3
- package/dist/components/snk-detail-view2.js +13 -7
- package/dist/components/snk-entity-list.js +0 -4
- package/dist/components/snk-filter-bar2.js +11 -11
- package/dist/components/snk-filter-detail2.js +2 -12
- package/dist/components/snk-filter-modal-item2.js +5 -16
- package/dist/components/snk-form-config2.js +5 -15
- package/dist/components/snk-form.js +8 -2
- package/dist/components/snk-grid-config2.js +4 -2
- package/dist/components/snk-grid2.js +11 -12
- package/dist/components/snk-personalized-filter2.js +11 -11
- package/dist/components/snk-taskbar2.js +3 -1
- package/dist/esm/{ConfigStorage-b6aefe42.js → ConfigStorage-cfe03e99.js} +160 -46
- package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
- package/dist/esm/{SnkFormConfigManager-80901f2d.js → SnkFormConfigManager-bfd8eabd.js} +18 -20
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +11 -8
- package/dist/esm/snk-application.entry.js +42 -38
- package/dist/esm/snk-configurator.entry.js +2 -1
- package/dist/esm/snk-crud.entry.js +16 -5
- package/dist/esm/snk-data-exporter.entry.js +1 -1
- package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-3ab57d1a.js} +4 -3
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +6 -6
- package/dist/esm/snk-entity-list.entry.js +0 -4
- package/dist/esm/snk-filter-bar.entry.js +11 -13
- package/dist/esm/snk-filter-detail.entry.js +2 -16
- package/dist/esm/snk-filter-modal-item.entry.js +4 -17
- package/dist/esm/snk-form-config.entry.js +5 -15
- package/dist/esm/snk-form.entry.js +9 -5
- package/dist/esm/snk-grid-config.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +11 -14
- package/dist/esm/{snk-guides-viewer-ee42eb53.js → snk-guides-viewer-3ea14ab4.js} +9 -5
- package/dist/esm/snk-guides-viewer.entry.js +3 -4
- package/dist/esm/snk-personalized-filter.entry.js +11 -13
- package/dist/esm/snk-taskbar.entry.js +2 -1
- package/dist/sankhyablocks/p-0ae5b923.entry.js +1 -0
- package/dist/sankhyablocks/p-15230263.js +1 -0
- package/dist/sankhyablocks/p-18fa618e.entry.js +1 -0
- package/dist/sankhyablocks/p-48a40939.js +1 -0
- package/dist/sankhyablocks/p-4c33a77c.entry.js +1 -0
- package/dist/sankhyablocks/p-53884b5f.entry.js +1 -0
- package/dist/sankhyablocks/p-688dcb4c.js +1 -0
- package/dist/sankhyablocks/p-70e785db.entry.js +1 -0
- package/dist/sankhyablocks/p-861a3495.entry.js +1 -0
- package/dist/sankhyablocks/p-878b0dd3.entry.js +1 -0
- package/dist/sankhyablocks/p-97d2fbd9.entry.js +1 -0
- package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
- package/dist/sankhyablocks/p-9d591463.js +1 -0
- package/dist/sankhyablocks/p-9d93da18.js +56 -0
- package/dist/sankhyablocks/{p-77ecc583.entry.js → p-9f387187.entry.js} +1 -1
- package/dist/sankhyablocks/p-aa4c112f.entry.js +11 -0
- package/dist/sankhyablocks/p-bae87498.entry.js +1 -0
- package/dist/sankhyablocks/p-cc67bd06.entry.js +1 -0
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
- package/dist/sankhyablocks/p-e070d7a3.entry.js +1 -0
- package/dist/sankhyablocks/p-e086cc2a.entry.js +1 -0
- package/dist/sankhyablocks/p-ed705cbb.entry.js +1 -0
- package/dist/sankhyablocks/p-fa523d6b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
- package/dist/types/components/snk-application/snk-application.d.ts +8 -13
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +1 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +4 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -2
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +4 -0
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
- package/dist/types/components/snk-form/snk-form.d.ts +5 -1
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +4 -0
- package/dist/types/components.d.ts +99 -21
- package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
- package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
- package/package.json +1 -1
- package/dist/cjs/filter-bar-config-fetcher-80b033ce.js +0 -155
- package/dist/components/filter-bar-config-fetcher.js +0 -153
- package/dist/components/resource-fetcher.js +0 -66
- package/dist/esm/filter-bar-config-fetcher-317cb6bf.js +0 -153
- package/dist/sankhyablocks/p-0b64f036.entry.js +0 -1
- package/dist/sankhyablocks/p-0e97ec46.entry.js +0 -1
- package/dist/sankhyablocks/p-35ecafcb.entry.js +0 -1
- package/dist/sankhyablocks/p-42843f0e.js +0 -1
- package/dist/sankhyablocks/p-459d4267.entry.js +0 -1
- package/dist/sankhyablocks/p-557affc8.entry.js +0 -1
- package/dist/sankhyablocks/p-564efc43.js +0 -1
- package/dist/sankhyablocks/p-6295424d.entry.js +0 -1
- package/dist/sankhyablocks/p-803b79d6.js +0 -1
- package/dist/sankhyablocks/p-80729c9b.entry.js +0 -11
- package/dist/sankhyablocks/p-95fa8af6.entry.js +0 -1
- package/dist/sankhyablocks/p-96c1ae78.entry.js +0 -1
- package/dist/sankhyablocks/p-b556fadc.entry.js +0 -1
- package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
- package/dist/sankhyablocks/p-bf3bd954.entry.js +0 -1
- package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
- package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
- package/dist/sankhyablocks/p-dd1fa35d.js +0 -56
- package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
- package/dist/sankhyablocks/p-e42f1f2a.js +0 -1
- package/dist/sankhyablocks/p-f24c4bc7.entry.js +0 -1
- package/dist/sankhyablocks/p-fd69eab9.entry.js +0 -1
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
|
|
7
7
|
const DataFetcher = require('./DataFetcher-d2c6ae38.js');
|
8
8
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
9
9
|
const pesquisaFetcher = require('./pesquisa-fetcher-bb0bb679.js');
|
10
|
-
const ConfigStorage = require('./ConfigStorage-
|
10
|
+
const ConfigStorage = require('./ConfigStorage-d688c739.js');
|
11
11
|
const dataunitFetcher = require('./dataunit-fetcher-58ad78a7.js');
|
12
12
|
const authFetcher = require('./auth-fetcher-da975ac5.js');
|
13
13
|
const SnkMessageBuilder = require('./SnkMessageBuilder-d0abb63d.js');
|
@@ -15,7 +15,6 @@ require('./_commonjsHelpers-537d719a.js');
|
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
16
16
|
require('./form-config-fetcher-761994b9.js');
|
17
17
|
require('./resource-fetcher-95d24dff.js');
|
18
|
-
require('./filter-bar-config-fetcher-80b033ce.js');
|
19
18
|
require('./filter-item-type.enum-aa823a00.js');
|
20
19
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
21
20
|
|
@@ -256,16 +255,21 @@ const SnkApplication = class {
|
|
256
255
|
}
|
257
256
|
return this._parameters;
|
258
257
|
}
|
259
|
-
|
260
|
-
if (
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
258
|
+
async getAuth(resourceID) {
|
259
|
+
if (resourceID == undefined) {
|
260
|
+
return this.getApplicationAuth();
|
261
|
+
}
|
262
|
+
else {
|
263
|
+
return new Promise((resolve, reject) => {
|
264
|
+
this.authFetcher.getData(resourceID).then((authList) => {
|
265
|
+
resolve(authList);
|
266
|
+
}).catch(error => {
|
267
|
+
reject(error);
|
268
|
+
});
|
269
|
+
});
|
265
270
|
}
|
266
|
-
return this._resourceID;
|
267
271
|
}
|
268
|
-
|
272
|
+
async getApplicationAuth() {
|
269
273
|
if (this._auth) {
|
270
274
|
return Promise.resolve(this._auth);
|
271
275
|
}
|
@@ -274,7 +278,7 @@ const SnkApplication = class {
|
|
274
278
|
const waitingAuth = this._authPromises.length > 0;
|
275
279
|
this._authPromises.push(new PendingPromise(resolve, reject));
|
276
280
|
if (!waitingAuth) {
|
277
|
-
this.authFetcher.getData(this.
|
281
|
+
this.authFetcher.getData(this.applicationResourceID).then((authList) => {
|
278
282
|
this._auth = authList;
|
279
283
|
while (this._authPromises.length > 0) {
|
280
284
|
this._authPromises.pop().resolve(this._auth);
|
@@ -293,7 +297,7 @@ const SnkApplication = class {
|
|
293
297
|
*/
|
294
298
|
async isUserSup() {
|
295
299
|
return new Promise((resolve, reject) => {
|
296
|
-
this.
|
300
|
+
this.getAuth().then((authorization) => {
|
297
301
|
this.getAuthList(authorization).then((auths) => {
|
298
302
|
resolve(auths.isSup);
|
299
303
|
}).catch(error => reject(error));
|
@@ -307,9 +311,9 @@ const SnkApplication = class {
|
|
307
311
|
/**
|
308
312
|
* Obtém `true` caso o usuário logado tem permissão pra determinada ação.
|
309
313
|
*/
|
310
|
-
async hasAccess(access) {
|
314
|
+
async hasAccess(access, resourceID) {
|
311
315
|
return new Promise((resolve, reject) => {
|
312
|
-
this.
|
316
|
+
this.getAuth(resourceID).then((authorization) => {
|
313
317
|
this.getAuthList(authorization).then((auths) => {
|
314
318
|
resolve(auths.isSup || auths.actions[access]);
|
315
319
|
}).catch(error => reject(error));
|
@@ -319,9 +323,9 @@ const SnkApplication = class {
|
|
319
323
|
/**
|
320
324
|
* Obtém todos os acessos do usuário logado.
|
321
325
|
*/
|
322
|
-
async getAllAccess() {
|
326
|
+
async getAllAccess(resourceID) {
|
323
327
|
return new Promise((resolve, reject) => {
|
324
|
-
this.
|
328
|
+
this.getAuth(resourceID).then((authorization) => {
|
325
329
|
this.getAuthList(authorization).then((auths) => {
|
326
330
|
const allAccess = {};
|
327
331
|
allAccess['isSup'] = auths.isSup;
|
@@ -505,13 +509,16 @@ const SnkApplication = class {
|
|
505
509
|
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
506
510
|
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
|
507
511
|
*/
|
508
|
-
async createDataunit(entityName, dataUnitName, parentDataUnit, configName) {
|
512
|
+
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
513
|
+
if (resourceID == undefined) {
|
514
|
+
resourceID = this.applicationResourceID;
|
515
|
+
}
|
509
516
|
return new Promise((resolve, reject) => {
|
510
517
|
const duPromisses = this.getDuPromissesStack(dataUnitName);
|
511
518
|
const waitingDu = duPromisses.length > 0;
|
512
519
|
duPromisses.push(new PendingPromise(resolve, reject));
|
513
520
|
if (!waitingDu) {
|
514
|
-
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName,
|
521
|
+
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
|
515
522
|
dataUnit.loadMetadata().then(() => {
|
516
523
|
if (dataUnitName) {
|
517
524
|
this.updateDataunitCache(undefined, dataUnitName, dataUnit);
|
@@ -542,14 +549,14 @@ const SnkApplication = class {
|
|
542
549
|
/**
|
543
550
|
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
544
551
|
*/
|
545
|
-
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName) {
|
552
|
+
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
546
553
|
return new Promise((resolve, reject) => {
|
547
554
|
const dataUnit = this._duCache.get(dataUnitName);
|
548
555
|
if (dataUnit) {
|
549
556
|
resolve(dataUnit);
|
550
557
|
}
|
551
558
|
else {
|
552
|
-
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName).then(dataUnit => {
|
559
|
+
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
|
553
560
|
resolve(dataUnit);
|
554
561
|
}).catch(reason => reject(reason));
|
555
562
|
}
|
@@ -598,11 +605,20 @@ const SnkApplication = class {
|
|
598
605
|
async callServiceBroker(serviceName, payload, options) {
|
599
606
|
return DataFetcher.DataFetcher.get().callServiceBroker(serviceName, payload, options);
|
600
607
|
}
|
608
|
+
get applicationResourceID() {
|
609
|
+
if (!this._applicationResourceID) {
|
610
|
+
this._applicationResourceID = this.urlParams.get("workspaceResourceID") ||
|
611
|
+
this.urlParams.get("resourceID") ||
|
612
|
+
Workspace.resourceID ||
|
613
|
+
"unknown.resource.id";
|
614
|
+
}
|
615
|
+
return this._applicationResourceID;
|
616
|
+
}
|
601
617
|
/**
|
602
618
|
* Obtém o resourceID da tela em questão.
|
603
619
|
*/
|
604
620
|
async getResourceID() {
|
605
|
-
return Promise.resolve(this.
|
621
|
+
return Promise.resolve(this.applicationResourceID);
|
606
622
|
}
|
607
623
|
/**
|
608
624
|
* Obtém o UserId da tela em questão.
|
@@ -646,20 +662,14 @@ const SnkApplication = class {
|
|
646
662
|
async info(message, options) {
|
647
663
|
return utils.ApplicationUtils.info(message, options);
|
648
664
|
}
|
649
|
-
/**
|
650
|
-
* Obtém a configuração de grade.
|
651
|
-
*/
|
652
|
-
async loadGridConfig(name) {
|
653
|
-
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
654
|
-
}
|
655
665
|
/**
|
656
666
|
* Obtém os totalizadores da grade.
|
657
667
|
*/
|
658
668
|
async loadTotals(name, resourceID, filters) {
|
659
669
|
return this.totalsFetcher.fetchTotals(name, resourceID, filters);
|
660
670
|
}
|
661
|
-
async getAuthList(
|
662
|
-
return await (new MGEAuthorization()).parseFromJSON(
|
671
|
+
async getAuthList(auth) {
|
672
|
+
return await (new MGEAuthorization()).parseFromJSON(auth);
|
663
673
|
}
|
664
674
|
get urlParams() {
|
665
675
|
if (!this._urlParams) {
|
@@ -673,12 +683,6 @@ const SnkApplication = class {
|
|
673
683
|
}
|
674
684
|
return this._dataUnitFetcher;
|
675
685
|
}
|
676
|
-
get gridConfigFetcher() {
|
677
|
-
if (!this._gridConfigFetcher) {
|
678
|
-
this._gridConfigFetcher = new ConfigStorage.GridConfigFetcher();
|
679
|
-
}
|
680
|
-
return this._gridConfigFetcher;
|
681
|
-
}
|
682
686
|
get totalsFetcher() {
|
683
687
|
if (!this._totalsFetcher) {
|
684
688
|
this._totalsFetcher = new TotalsFetcher();
|
@@ -776,7 +780,7 @@ const SnkApplication = class {
|
|
776
780
|
* Obtém o nome das telas da aplicação
|
777
781
|
*/
|
778
782
|
async getAppLabel() {
|
779
|
-
return Workspace.getAppLabel(this.
|
783
|
+
return Workspace.getAppLabel(this.applicationResourceID);
|
780
784
|
}
|
781
785
|
/**
|
782
786
|
* Adiciona um listener no fetcher de Pesquisa
|
@@ -856,7 +860,7 @@ const SnkApplication = class {
|
|
856
860
|
});
|
857
861
|
core.ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
858
862
|
core.ErrorTracking.init();
|
859
|
-
ConfigStorage.ConfigStorage.
|
863
|
+
ConfigStorage.ConfigStorage.preload(this.applicationResourceID, this.configName);
|
860
864
|
}
|
861
865
|
connectedCallback() {
|
862
866
|
core.ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
|
@@ -870,7 +874,7 @@ const SnkApplication = class {
|
|
870
874
|
window.requestAnimationFrame(() => {
|
871
875
|
this.applicationLoaded.emit(true);
|
872
876
|
});
|
873
|
-
core.ElementIDUtils.addIDInfo(this._element, `resource_${this.
|
877
|
+
core.ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
|
874
878
|
}
|
875
879
|
render() {
|
876
880
|
return (index.h("div", null, index.h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), index.h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), index.h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
|
@@ -20,6 +20,7 @@ const SnkConfigurator = class {
|
|
20
20
|
this._permissions = undefined;
|
21
21
|
this.showActionButtons = false;
|
22
22
|
this.configName = undefined;
|
23
|
+
this.resourceID = undefined;
|
23
24
|
this.viewMode = constants.VIEW_MODE.GRID;
|
24
25
|
this.messagesBuilder = undefined;
|
25
26
|
}
|
@@ -84,7 +85,7 @@ const SnkConfigurator = class {
|
|
84
85
|
componentWillLoad() {
|
85
86
|
this._application = core.ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
86
87
|
if (this._application) {
|
87
|
-
this._application.getAllAccess().then(access => (this._permissions = access));
|
88
|
+
this._application.getAllAccess(this.resourceID).then(access => (this._permissions = access));
|
88
89
|
}
|
89
90
|
else {
|
90
91
|
this._permissions = {};
|
@@ -30,6 +30,7 @@ const SnkCrud = class {
|
|
30
30
|
this.attachmentRegisterKey = undefined;
|
31
31
|
this._currentViewMode = constants.VIEW_MODE.GRID;
|
32
32
|
this._canEdit = undefined;
|
33
|
+
this._resourceID = undefined;
|
33
34
|
this.configName = undefined;
|
34
35
|
this.selectionToastConfig = undefined;
|
35
36
|
this.showActionButtons = false;
|
@@ -124,7 +125,7 @@ const SnkCrud = class {
|
|
124
125
|
}
|
125
126
|
componentWillLoad() {
|
126
127
|
const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
127
|
-
application.hasAccess(authFetcher.AutorizationType.UPDATE).then(canEdit => this._canEdit = canEdit);
|
128
|
+
application.hasAccess(authFetcher.AutorizationType.UPDATE, this._resourceID).then(canEdit => this._canEdit = canEdit);
|
128
129
|
let parent = this._element.parentElement;
|
129
130
|
while (parent) {
|
130
131
|
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
@@ -136,11 +137,11 @@ const SnkCrud = class {
|
|
136
137
|
if (!this._dataUnit) {
|
137
138
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
138
139
|
this._dataUnit = evt.detail;
|
139
|
-
this.initDataUnit();
|
140
|
+
this.initDataUnit(application);
|
140
141
|
});
|
141
142
|
}
|
142
143
|
else {
|
143
|
-
this.initDataUnit();
|
144
|
+
this.initDataUnit(application);
|
144
145
|
}
|
145
146
|
this._snkDataUnit.addEventListener("dataStateChange", async ({ detail: dataState }) => {
|
146
147
|
this._dataState = dataState;
|
@@ -156,11 +157,18 @@ const SnkCrud = class {
|
|
156
157
|
this.configName = application.configName;
|
157
158
|
}
|
158
159
|
}
|
159
|
-
initDataUnit() {
|
160
|
+
async initDataUnit(application) {
|
160
161
|
this.addDataElementID();
|
161
162
|
if (!this.messagesBuilder) {
|
162
163
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
163
164
|
}
|
165
|
+
if (this._resourceID == undefined) {
|
166
|
+
//Tenta pegar o resourceID do snkDataUnit;
|
167
|
+
this._resourceID = this._snkDataUnit.resourceID;
|
168
|
+
if (this._resourceID == undefined) {
|
169
|
+
this._resourceID = await application.getResourceID();
|
170
|
+
}
|
171
|
+
}
|
164
172
|
}
|
165
173
|
handleConfiguratorEvent(evt, type) {
|
166
174
|
evt.stopImmediatePropagation();
|
@@ -171,8 +179,11 @@ const SnkCrud = class {
|
|
171
179
|
this.configuratorCancel.emit();
|
172
180
|
}
|
173
181
|
render() {
|
182
|
+
if (this._resourceID == undefined) {
|
183
|
+
return;
|
184
|
+
}
|
174
185
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === constants.VIEW_MODE.GRID;
|
175
|
-
return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, index.h("stack-item", null, index.h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(constants.VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit }, index.h("slot", { name: "SnkFormTaskBar" }))), index.h("stack-item", null, index.h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL') }, index.h("div", { slot: "SnkConfigContainerSlot" }, index.h("slot", { name: "SnkConfigContainerSlot" })))));
|
186
|
+
return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, index.h("stack-item", null, index.h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(constants.VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, resourceID: this._resourceID }, index.h("slot", { name: "SnkFormTaskBar" }))), index.h("stack-item", null, index.h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), index.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID }, index.h("div", { slot: "SnkConfigContainerSlot" }, index.h("slot", { name: "SnkConfigContainerSlot" })))));
|
176
187
|
}
|
177
188
|
get _element() { return index.getElement(this); }
|
178
189
|
static get watchers() { return {
|
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const index = require('./index-0e663819.js');
|
9
9
|
const constants = require('./constants-d187e03e.js');
|
10
10
|
const DataFetcher = require('./DataFetcher-d2c6ae38.js');
|
11
|
-
const snkDataUnit = require('./snk-data-unit-
|
11
|
+
const snkDataUnit = require('./snk-data-unit-80a00ae4.js');
|
12
12
|
require('./_commonjsHelpers-537d719a.js');
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
14
14
|
require('./SnkMessageBuilder-d0abb63d.js');
|
@@ -72,6 +72,7 @@ const SnkDataUnit = class {
|
|
72
72
|
this.useCancelConfirm = true;
|
73
73
|
this.ignoreSaveMessage = undefined;
|
74
74
|
this.configName = undefined;
|
75
|
+
this.resourceID = undefined;
|
75
76
|
}
|
76
77
|
observePageSize() {
|
77
78
|
if (this.dataUnit) {
|
@@ -335,10 +336,10 @@ const SnkDataUnit = class {
|
|
335
336
|
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
336
337
|
if (this._parentSnkDataUnit) {
|
337
338
|
this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
338
|
-
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName);
|
339
|
+
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID);
|
339
340
|
}
|
340
341
|
else {
|
341
|
-
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName);
|
342
|
+
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
342
343
|
}
|
343
344
|
}
|
344
345
|
async loadDataUnit() {
|
@@ -397,7 +398,7 @@ const SnkDataUnit = class {
|
|
397
398
|
//---------------------------------------------
|
398
399
|
componentWillLoad() {
|
399
400
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
400
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
401
|
+
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
401
402
|
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
402
403
|
if (this.messagesBuilder == undefined) {
|
403
404
|
this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder(this.entityName);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const snkDataUnit = require('./snk-data-unit-
|
5
|
+
const snkDataUnit = require('./snk-data-unit-80a00ae4.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('@sankhyalabs/ezui/dist/collection/utils');
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
5
|
const index = require('./index-f9e81701.js');
|
6
|
-
const SnkFormConfigManager = require('./SnkFormConfigManager-
|
6
|
+
const SnkFormConfigManager = require('./SnkFormConfigManager-29b73c81.js');
|
7
7
|
const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
|
8
8
|
require('./DataFetcher-d2c6ae38.js');
|
9
9
|
require('./pesquisa-fetcher-bb0bb679.js');
|
@@ -11,12 +11,11 @@ require('@sankhyalabs/core');
|
|
11
11
|
const index$1 = require('./index-0e663819.js');
|
12
12
|
const taskbarElements = require('./taskbar-elements-b98dd6e9.js');
|
13
13
|
const constants = require('./constants-d187e03e.js');
|
14
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
14
|
+
const snkGuidesViewer = require('./snk-guides-viewer-f67f9cea.js');
|
15
15
|
const SnkMessageBuilder = require('./SnkMessageBuilder-d0abb63d.js');
|
16
|
-
require('./ConfigStorage-
|
16
|
+
require('./ConfigStorage-d688c739.js');
|
17
17
|
require('./form-config-fetcher-761994b9.js');
|
18
18
|
require('./resource-fetcher-95d24dff.js');
|
19
|
-
require('./filter-bar-config-fetcher-80b033ce.js');
|
20
19
|
require('./filter-item-type.enum-aa823a00.js');
|
21
20
|
require('./_commonjsHelpers-537d719a.js');
|
22
21
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
@@ -80,6 +79,7 @@ const SnkDetailView = class {
|
|
80
79
|
this.attachmentRegisterKey = undefined;
|
81
80
|
this.formConfigManager = undefined;
|
82
81
|
this.dataUnitName = undefined;
|
82
|
+
this.resourceID = undefined;
|
83
83
|
this.guideItemPath = undefined;
|
84
84
|
this.entityName = undefined;
|
85
85
|
this.label = undefined;
|
@@ -249,7 +249,7 @@ const SnkDetailView = class {
|
|
249
249
|
}
|
250
250
|
componentWillLoad() {
|
251
251
|
this._configName = `dynaform.${this.entityName}`;
|
252
|
-
this.formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this._configName, () => this.loadMetadata());
|
252
|
+
this.formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata());
|
253
253
|
this.formConfigManager.loadConfig();
|
254
254
|
if (this.messagesBuilder == undefined) {
|
255
255
|
this.messagesBuilder = new SnkMessageBuilder.SnkMessageBuilder(this.entityName);
|
@@ -258,7 +258,7 @@ const SnkDetailView = class {
|
|
258
258
|
render() {
|
259
259
|
this.updateLabel();
|
260
260
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
261
|
-
return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-flex ez-title--primary ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full ez-size-height--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: index$1.PresentationMode.SECONDARY, canEdit: this.canEdit, isDetail: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems) }, index.h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: index$1.PresentationMode.SECONDARY, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit }))), index.h("stack-item", null, index.h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
|
261
|
+
return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => this._snkDataUnit = el, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, index.h("stack-item", null, index.h("div", { class: "ez-box ez-box--shadow grid-container" }, index.h("div", { class: "ez-flex ez-title--primary ez-size-width--full ez-padding--large detail-header" }, index.h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? index.h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), index.h("snk-grid", { class: "ez-size-width--full ez-size-height--full", ref: (ref) => this._snkGrid = ref, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.emitSwitchEvent(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: index$1.PresentationMode.SECONDARY, canEdit: this.canEdit, isDetail: true }))), index.h("stack-item", null, index.h("snk-form-view", { ref: (ref) => this._snkFormView = ref, canExpand: false, canFix: false, name: this.selectedForm, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), label: this.label, levelPath: this._levelPath, onFormItemsReady: ({ detail: formItems }) => this.formItemsReady.emit(formItems) }, index.h("snk-taskbar", { key: "guideViewerTaskbar", class: "form-taskbar", "data-element-id": "guideViewer", configName: this._configName, messagesBuilder: this.messagesBuilder, disabledButtons: this._disabledButtons, buttons: "INSERT,PREVIOUS,NEXT,DIVIDER,CLONE,REMOVE,MORE_OPTIONS,DIVIDER,GRID_MODE,CONFIGURATOR", primaryButton: "INSERT", presentationMode: index$1.PresentationMode.SECONDARY, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID }))), index.h("stack-item", null, index.h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
|
262
262
|
}
|
263
263
|
static get watchers() { return {
|
264
264
|
"dataState": ["observerDataState"]
|
@@ -11,7 +11,6 @@ const SnkEntityList = class {
|
|
11
11
|
constructor(hostRef) {
|
12
12
|
index.registerInstance(this, hostRef);
|
13
13
|
this.valueChanged = index.createEvent(this, "valueChanged", 7);
|
14
|
-
this.saveConfig = index.createEvent(this, "saveConfig", 7);
|
15
14
|
this._searchValue = undefined;
|
16
15
|
this._ezListSource = [];
|
17
16
|
this.config = undefined;
|
@@ -20,7 +19,6 @@ const SnkEntityList = class {
|
|
20
19
|
}
|
21
20
|
async reloadList() {
|
22
21
|
this.loadListSource();
|
23
|
-
this.saveConfig.emit(this.config);
|
24
22
|
}
|
25
23
|
observeConfig() {
|
26
24
|
var _a, _b;
|
@@ -36,7 +34,6 @@ const SnkEntityList = class {
|
|
36
34
|
}
|
37
35
|
});
|
38
36
|
this.config = core.ObjectUtils.copy(configCopy);
|
39
|
-
this.saveConfig.emit(this.config);
|
40
37
|
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
41
38
|
}
|
42
39
|
loadListSource() {
|
@@ -93,7 +90,6 @@ const SnkEntityList = class {
|
|
93
90
|
}
|
94
91
|
] });
|
95
92
|
this.loadListSource();
|
96
|
-
this.saveConfig.emit(this.config);
|
97
93
|
this.valueChanged.emit((_d = this.config) === null || _d === void 0 ? void 0 : _d.value);
|
98
94
|
}
|
99
95
|
}
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
const index$1 = require('./index-f9e81701.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
|
8
|
-
const ConfigStorage = require('./ConfigStorage-
|
8
|
+
const ConfigStorage = require('./ConfigStorage-d688c739.js');
|
9
9
|
const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
|
10
10
|
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
11
11
|
const index = require('./index-c5771aba.js');
|
@@ -16,7 +16,6 @@ require('./DataFetcher-d2c6ae38.js');
|
|
16
16
|
require('./_commonjsHelpers-537d719a.js');
|
17
17
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
18
18
|
require('./resource-fetcher-95d24dff.js');
|
19
|
-
require('./filter-bar-config-fetcher-80b033ce.js');
|
20
19
|
|
21
20
|
const buildFilter = (item) => {
|
22
21
|
switch (item.type) {
|
@@ -208,6 +207,7 @@ const SnkFilterBar = class {
|
|
208
207
|
};
|
209
208
|
this.dataUnit = undefined;
|
210
209
|
this.configName = undefined;
|
210
|
+
this.resourceID = undefined;
|
211
211
|
this.filterConfig = undefined;
|
212
212
|
this.messagesBuilder = undefined;
|
213
213
|
this.allowDefault = undefined;
|
@@ -287,7 +287,7 @@ const SnkFilterBar = class {
|
|
287
287
|
}
|
288
288
|
if (this._configUpdated) {
|
289
289
|
this._configUpdated = false;
|
290
|
-
ConfigStorage.ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName);
|
290
|
+
ConfigStorage.ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
|
291
291
|
}
|
292
292
|
}
|
293
293
|
/**
|
@@ -403,15 +403,13 @@ const SnkFilterBar = class {
|
|
403
403
|
}
|
404
404
|
loadConfigFromStorage() {
|
405
405
|
return new Promise(accept => {
|
406
|
-
ConfigStorage.ConfigStorage.
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
throw new core.ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
414
|
-
});
|
406
|
+
ConfigStorage.ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
|
407
|
+
.then((filters) => {
|
408
|
+
accept();
|
409
|
+
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
410
|
+
})
|
411
|
+
.catch(reason => {
|
412
|
+
throw new core.ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
415
413
|
});
|
416
414
|
});
|
417
415
|
}
|
@@ -496,7 +494,7 @@ const SnkFilterBar = class {
|
|
496
494
|
return undefined;
|
497
495
|
}
|
498
496
|
if (this.showPersonalizedFilter) {
|
499
|
-
return index$1.h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName });
|
497
|
+
return index$1.h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
500
498
|
}
|
501
499
|
return (index$1.h(index$1.Host, null, index$1.h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, index$1.h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), index$1.h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, index$1.h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
502
500
|
}
|
@@ -6,13 +6,8 @@ const index = require('./index-f9e81701.js');
|
|
6
6
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
7
7
|
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
8
8
|
const core = require('@sankhyalabs/core');
|
9
|
-
const filterBarConfigFetcher = require('./filter-bar-config-fetcher-80b033ce.js');
|
10
9
|
const presentationMode = require('./presentationMode-52ec3bdd.js');
|
11
10
|
const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-1aeb625d.js');
|
12
|
-
require('./resource-fetcher-95d24dff.js');
|
13
|
-
require('./DataFetcher-d2c6ae38.js');
|
14
|
-
require('./_commonjsHelpers-537d719a.js');
|
15
|
-
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
16
11
|
require('./index-c5771aba.js');
|
17
12
|
|
18
13
|
const SnkFilterDetail = class {
|
@@ -36,7 +31,6 @@ const SnkFilterDetail = class {
|
|
36
31
|
}
|
37
32
|
componentDidLoad() {
|
38
33
|
if (this._element) {
|
39
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
40
34
|
core.ElementIDUtils.addIDInfo(this._element);
|
41
35
|
const dataElementIdDoFilterItem = this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
42
36
|
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
@@ -154,20 +148,12 @@ const SnkFilterDetail = class {
|
|
154
148
|
this.config = core.ObjectUtils.copy(configCopy);
|
155
149
|
}
|
156
150
|
}
|
157
|
-
saveConfig(newConfig) {
|
158
|
-
var _a;
|
159
|
-
(_a = this._application) === null || _a === void 0 ? void 0 : _a.getResourceID().then(resourceId => {
|
160
|
-
const fetcher = new filterBarConfigFetcher.FilterBarConfigFetcher();
|
161
|
-
fetcher.saveEntityListConfig(newConfig, resourceId, this._application.configName);
|
162
|
-
this.config = newConfig;
|
163
|
-
});
|
164
|
-
}
|
165
151
|
componentWillLoad() {
|
166
152
|
this.originalConfig = core.ObjectUtils.copy(this.config);
|
167
153
|
}
|
168
154
|
render() {
|
169
155
|
const { tag: CustomElement, props } = this.getContentEditor();
|
170
|
-
return (index.h(index.Host, null, index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), index.h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage,
|
156
|
+
return (index.h(index.Host, null, index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), index.h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, rightListSlotBuilder: item => this.buildRightSlot(item) }, props)), index.h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), index.h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (index.h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), index.h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
171
157
|
}
|
172
158
|
get _element() { return index.getElement(this); }
|
173
159
|
static get watchers() { return {
|
@@ -6,14 +6,13 @@ const index = require('./index-f9e81701.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
7
|
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
8
8
|
const presentationMode = require('./presentationMode-52ec3bdd.js');
|
9
|
-
const ConfigStorage = require('./ConfigStorage-
|
9
|
+
const ConfigStorage = require('./ConfigStorage-d688c739.js');
|
10
10
|
const filterType_enum = require('./filter-type.enum-b14ce507.js');
|
11
11
|
require('./form-config-fetcher-761994b9.js');
|
12
12
|
require('./DataFetcher-d2c6ae38.js');
|
13
13
|
require('./_commonjsHelpers-537d719a.js');
|
14
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
15
15
|
require('./resource-fetcher-95d24dff.js');
|
16
|
-
require('./filter-bar-config-fetcher-80b033ce.js');
|
17
16
|
|
18
17
|
const snkFilterModalItemCss = ".grow{flex-grow:1}.gap{gap:4px}";
|
19
18
|
|
@@ -25,14 +24,13 @@ const SnkFilterModalItem = class {
|
|
25
24
|
this.addPersonalizedFilter = index.createEvent(this, "addPersonalizedFilter", 7);
|
26
25
|
this.filterItem = undefined;
|
27
26
|
this.configName = undefined;
|
27
|
+
this.resourceID = undefined;
|
28
28
|
}
|
29
29
|
observeFilterItem(newValue) {
|
30
30
|
var _a, _b;
|
31
31
|
this._editor && (this._editor["config"] = newValue);
|
32
32
|
(_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a['reloadList']) === null || _b === void 0 ? void 0 : _b.call(_a);
|
33
33
|
this.filterChange.emit(newValue);
|
34
|
-
//isso faz o filtro salvar o estado precocemente. Caso: Botão limpar filtro dispara dezenas de vezes
|
35
|
-
//this.saveConfig();
|
36
34
|
}
|
37
35
|
getContentEditorConfig() {
|
38
36
|
const props = { presentationMode: presentationMode.EPresentationMode.MODAL };
|
@@ -74,11 +72,10 @@ const SnkFilterModalItem = class {
|
|
74
72
|
else {
|
75
73
|
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === filterItemType_enum.FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
|
76
74
|
}
|
77
|
-
this.saveConfig();
|
78
75
|
}
|
79
76
|
handleDeleteFilter(filter, filterItemType) {
|
80
77
|
if (filterItemType === filterItemType_enum.FilterItemType.PERSONALIZED) {
|
81
|
-
ConfigStorage.ConfigStorage.removePersonalizedFilter(filter, this.configName);
|
78
|
+
ConfigStorage.ConfigStorage.removePersonalizedFilter(filter, this.resourceID, this.configName);
|
82
79
|
}
|
83
80
|
}
|
84
81
|
componentDidLoad() {
|
@@ -86,7 +83,6 @@ const SnkFilterModalItem = class {
|
|
86
83
|
core.ElementIDUtils.addIDInfo(this._element);
|
87
84
|
const dataElementIdDoFilterItem = this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
88
85
|
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.filterItem.id}`;
|
89
|
-
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
90
86
|
}
|
91
87
|
}
|
92
88
|
buildRightSlot(item) {
|
@@ -103,15 +99,6 @@ const SnkFilterModalItem = class {
|
|
103
99
|
const { CUSTOM_FILTER, OTHER_FILTERS } = filterType_enum.FilterType;
|
104
100
|
return ![CUSTOM_FILTER, OTHER_FILTERS].includes(this.filterItem.filterType) && this.filterItem.type !== filterItemType_enum.FilterItemType.BINARY_SELECT;
|
105
101
|
}
|
106
|
-
saveConfig() {
|
107
|
-
//Precisa ser rediscutido... não podemos salvar configuração por conta própria. Não temos autonomia pra isso.
|
108
|
-
/*if(FilterItemType.MULTI_LIST !== this.filterItem.type) return;
|
109
|
-
|
110
|
-
this._application?.getResourceID().then(resourceId => {
|
111
|
-
const fetcher = new FilterBarConfigFetcher();
|
112
|
-
fetcher.saveEntityListConfig(this.filterItem, resourceId, this._application.configName);
|
113
|
-
});*/
|
114
|
-
}
|
115
102
|
render() {
|
116
103
|
const { tag: ContentEditor, props } = this.getContentEditorConfig();
|
117
104
|
return (index.h(index.Host, null, index.h("div", { class: "ez-flex ez-flex--column grow" }, this.canShowDetailModal() && (index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.h("div", { class: "ez-title ez-title--small ez-title--primary grow" }, this.filterItem.detailModal))), index.h(ContentEditor, Object.assign({ ref: ref => this._editor = ref, config: this.filterItem, value: this.filterItem.value, onValueChanged: (event) => this.updateFilterValue(event.detail), "data-element-id": this._idContentEditor }, props)))));
|