@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
@@ -4,6 +4,7 @@ import { D as DataFetcher } from './DataFetcher.js';
|
|
4
4
|
import { P as ParamType } from './ParamType.js';
|
5
5
|
import './pesquisa-fetcher.js';
|
6
6
|
import './index2.js';
|
7
|
+
import { R as ResourceIDUtils } from './ResourceIDUtils.js';
|
7
8
|
|
8
9
|
const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
|
9
10
|
class JavaExecutor {
|
@@ -158,13 +159,14 @@ const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
|
|
158
159
|
const NUFIN_COLUMN = 'NUFIN';
|
159
160
|
const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
|
160
161
|
class Actions {
|
161
|
-
constructor(actionsExecuteInterface, dataUnit) {
|
162
|
+
constructor(actionsExecuteInterface, dataUnit, appResourceId) {
|
162
163
|
var _a;
|
163
164
|
this._lastValuesCache = {};
|
164
165
|
this._actionsExecuteInterface = actionsExecuteInterface;
|
165
166
|
this._dataUnit = dataUnit;
|
166
167
|
this._selectedRows = ((_a = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo()) === null || _a === void 0 ? void 0 : _a.isAllRecords()) ? [] : dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo().records;
|
167
168
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
169
|
+
this._appResourceId = appResourceId;
|
168
170
|
}
|
169
171
|
apply(action, hasParamsToSave) {
|
170
172
|
this._application.closePopUp();
|
@@ -427,9 +429,7 @@ class Actions {
|
|
427
429
|
}
|
428
430
|
}
|
429
431
|
async buildResourceId(actionId) {
|
430
|
-
|
431
|
-
appResId = await this._application.getResourceID();
|
432
|
-
return appResId + '.actionconfig.' + actionId;
|
432
|
+
return this._appResourceId + '.actionconfig.' + actionId;
|
433
433
|
}
|
434
434
|
prepareAndExecute(execSource, executeAction) {
|
435
435
|
this.addRows(execSource);
|
@@ -588,7 +588,7 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
588
588
|
this.handleClick = (evt) => {
|
589
589
|
const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
|
590
590
|
const executor = new ExecutorFactory(selectedAction.type).executor;
|
591
|
-
const action = new Actions(executor, this._dataUnit);
|
591
|
+
const action = new Actions(executor, this._dataUnit, this._resourceID);
|
592
592
|
action.execute(Object.assign({}, selectedAction));
|
593
593
|
this._showDropdown = false;
|
594
594
|
};
|
@@ -646,12 +646,15 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
646
646
|
document.addEventListener("scroll", this.positionDropdown.bind(this));
|
647
647
|
}
|
648
648
|
async componentWillLoad() {
|
649
|
-
var _a;
|
650
649
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
651
|
-
this._resourceID = await this._application.getResourceID();
|
652
650
|
this._isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
|
653
|
-
|
651
|
+
const snkDataUnit = this._element.parentElement;
|
652
|
+
this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
|
653
|
+
this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
|
654
654
|
this._entityName = this._dataUnit.name.split('/')[2];
|
655
|
+
if (this._resourceID == undefined) {
|
656
|
+
this._resourceID = await ResourceIDUtils.getResourceID();
|
657
|
+
}
|
655
658
|
this.setEvents();
|
656
659
|
this.getActions().then(() => {
|
657
660
|
this.loadItems();
|
@@ -3,7 +3,7 @@ import { WaitingChangeException, WarningException, ErrorException, ObjectUtils,
|
|
3
3
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
|
4
4
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
5
5
|
import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
|
6
|
-
import {
|
6
|
+
import { C as ConfigStorage } from './ConfigStorage.js';
|
7
7
|
import { D as DataUnitFetcher } from './dataunit-fetcher.js';
|
8
8
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
|
9
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
@@ -247,16 +247,21 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
247
247
|
}
|
248
248
|
return this._parameters;
|
249
249
|
}
|
250
|
-
|
251
|
-
if (
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
250
|
+
async getAuth(resourceID) {
|
251
|
+
if (resourceID == undefined) {
|
252
|
+
return this.getApplicationAuth();
|
253
|
+
}
|
254
|
+
else {
|
255
|
+
return new Promise((resolve, reject) => {
|
256
|
+
this.authFetcher.getData(resourceID).then((authList) => {
|
257
|
+
resolve(authList);
|
258
|
+
}).catch(error => {
|
259
|
+
reject(error);
|
260
|
+
});
|
261
|
+
});
|
256
262
|
}
|
257
|
-
return this._resourceID;
|
258
263
|
}
|
259
|
-
|
264
|
+
async getApplicationAuth() {
|
260
265
|
if (this._auth) {
|
261
266
|
return Promise.resolve(this._auth);
|
262
267
|
}
|
@@ -265,7 +270,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
265
270
|
const waitingAuth = this._authPromises.length > 0;
|
266
271
|
this._authPromises.push(new PendingPromise(resolve, reject));
|
267
272
|
if (!waitingAuth) {
|
268
|
-
this.authFetcher.getData(this.
|
273
|
+
this.authFetcher.getData(this.applicationResourceID).then((authList) => {
|
269
274
|
this._auth = authList;
|
270
275
|
while (this._authPromises.length > 0) {
|
271
276
|
this._authPromises.pop().resolve(this._auth);
|
@@ -284,7 +289,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
284
289
|
*/
|
285
290
|
async isUserSup() {
|
286
291
|
return new Promise((resolve, reject) => {
|
287
|
-
this.
|
292
|
+
this.getAuth().then((authorization) => {
|
288
293
|
this.getAuthList(authorization).then((auths) => {
|
289
294
|
resolve(auths.isSup);
|
290
295
|
}).catch(error => reject(error));
|
@@ -298,9 +303,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
298
303
|
/**
|
299
304
|
* Obtém `true` caso o usuário logado tem permissão pra determinada ação.
|
300
305
|
*/
|
301
|
-
async hasAccess(access) {
|
306
|
+
async hasAccess(access, resourceID) {
|
302
307
|
return new Promise((resolve, reject) => {
|
303
|
-
this.
|
308
|
+
this.getAuth(resourceID).then((authorization) => {
|
304
309
|
this.getAuthList(authorization).then((auths) => {
|
305
310
|
resolve(auths.isSup || auths.actions[access]);
|
306
311
|
}).catch(error => reject(error));
|
@@ -310,9 +315,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
310
315
|
/**
|
311
316
|
* Obtém todos os acessos do usuário logado.
|
312
317
|
*/
|
313
|
-
async getAllAccess() {
|
318
|
+
async getAllAccess(resourceID) {
|
314
319
|
return new Promise((resolve, reject) => {
|
315
|
-
this.
|
320
|
+
this.getAuth(resourceID).then((authorization) => {
|
316
321
|
this.getAuthList(authorization).then((auths) => {
|
317
322
|
const allAccess = {};
|
318
323
|
allAccess['isSup'] = auths.isSup;
|
@@ -496,13 +501,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
496
501
|
* Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
|
497
502
|
* passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
|
498
503
|
*/
|
499
|
-
async createDataunit(entityName, dataUnitName, parentDataUnit, configName) {
|
504
|
+
async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
505
|
+
if (resourceID == undefined) {
|
506
|
+
resourceID = this.applicationResourceID;
|
507
|
+
}
|
500
508
|
return new Promise((resolve, reject) => {
|
501
509
|
const duPromisses = this.getDuPromissesStack(dataUnitName);
|
502
510
|
const waitingDu = duPromisses.length > 0;
|
503
511
|
duPromisses.push(new PendingPromise(resolve, reject));
|
504
512
|
if (!waitingDu) {
|
505
|
-
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName,
|
513
|
+
const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
|
506
514
|
dataUnit.loadMetadata().then(() => {
|
507
515
|
if (dataUnitName) {
|
508
516
|
this.updateDataunitCache(undefined, dataUnitName, dataUnit);
|
@@ -533,14 +541,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
533
541
|
/**
|
534
542
|
* Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
|
535
543
|
*/
|
536
|
-
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName) {
|
544
|
+
async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
|
537
545
|
return new Promise((resolve, reject) => {
|
538
546
|
const dataUnit = this._duCache.get(dataUnitName);
|
539
547
|
if (dataUnit) {
|
540
548
|
resolve(dataUnit);
|
541
549
|
}
|
542
550
|
else {
|
543
|
-
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName).then(dataUnit => {
|
551
|
+
this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
|
544
552
|
resolve(dataUnit);
|
545
553
|
}).catch(reason => reject(reason));
|
546
554
|
}
|
@@ -589,11 +597,20 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
589
597
|
async callServiceBroker(serviceName, payload, options) {
|
590
598
|
return DataFetcher.get().callServiceBroker(serviceName, payload, options);
|
591
599
|
}
|
600
|
+
get applicationResourceID() {
|
601
|
+
if (!this._applicationResourceID) {
|
602
|
+
this._applicationResourceID = this.urlParams.get("workspaceResourceID") ||
|
603
|
+
this.urlParams.get("resourceID") ||
|
604
|
+
Workspace.resourceID ||
|
605
|
+
"unknown.resource.id";
|
606
|
+
}
|
607
|
+
return this._applicationResourceID;
|
608
|
+
}
|
592
609
|
/**
|
593
610
|
* Obtém o resourceID da tela em questão.
|
594
611
|
*/
|
595
612
|
async getResourceID() {
|
596
|
-
return Promise.resolve(this.
|
613
|
+
return Promise.resolve(this.applicationResourceID);
|
597
614
|
}
|
598
615
|
/**
|
599
616
|
* Obtém o UserId da tela em questão.
|
@@ -637,20 +654,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
637
654
|
async info(message, options) {
|
638
655
|
return ApplicationUtils.info(message, options);
|
639
656
|
}
|
640
|
-
/**
|
641
|
-
* Obtém a configuração de grade.
|
642
|
-
*/
|
643
|
-
async loadGridConfig(name) {
|
644
|
-
return this.gridConfigFetcher.getConfig(name, this.resourceID);
|
645
|
-
}
|
646
657
|
/**
|
647
658
|
* Obtém os totalizadores da grade.
|
648
659
|
*/
|
649
660
|
async loadTotals(name, resourceID, filters) {
|
650
661
|
return this.totalsFetcher.fetchTotals(name, resourceID, filters);
|
651
662
|
}
|
652
|
-
async getAuthList(
|
653
|
-
return await (new MGEAuthorization()).parseFromJSON(
|
663
|
+
async getAuthList(auth) {
|
664
|
+
return await (new MGEAuthorization()).parseFromJSON(auth);
|
654
665
|
}
|
655
666
|
get urlParams() {
|
656
667
|
if (!this._urlParams) {
|
@@ -664,12 +675,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
664
675
|
}
|
665
676
|
return this._dataUnitFetcher;
|
666
677
|
}
|
667
|
-
get gridConfigFetcher() {
|
668
|
-
if (!this._gridConfigFetcher) {
|
669
|
-
this._gridConfigFetcher = new GridConfigFetcher();
|
670
|
-
}
|
671
|
-
return this._gridConfigFetcher;
|
672
|
-
}
|
673
678
|
get totalsFetcher() {
|
674
679
|
if (!this._totalsFetcher) {
|
675
680
|
this._totalsFetcher = new TotalsFetcher();
|
@@ -767,7 +772,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
767
772
|
* Obtém o nome das telas da aplicação
|
768
773
|
*/
|
769
774
|
async getAppLabel() {
|
770
|
-
return Workspace.getAppLabel(this.
|
775
|
+
return Workspace.getAppLabel(this.applicationResourceID);
|
771
776
|
}
|
772
777
|
/**
|
773
778
|
* Adiciona um listener no fetcher de Pesquisa
|
@@ -847,7 +852,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
847
852
|
});
|
848
853
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
849
854
|
ErrorTracking.init();
|
850
|
-
ConfigStorage.
|
855
|
+
ConfigStorage.preload(this.applicationResourceID, this.configName);
|
851
856
|
}
|
852
857
|
connectedCallback() {
|
853
858
|
ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
|
@@ -861,7 +866,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
861
866
|
window.requestAnimationFrame(() => {
|
862
867
|
this.applicationLoaded.emit(true);
|
863
868
|
});
|
864
|
-
ElementIDUtils.addIDInfo(this._element, `resource_${this.
|
869
|
+
ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
|
865
870
|
}
|
866
871
|
render() {
|
867
872
|
return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
|
@@ -905,7 +910,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
905
910
|
"message": [64],
|
906
911
|
"confirm": [64],
|
907
912
|
"info": [64],
|
908
|
-
"loadGridConfig": [64],
|
909
913
|
"loadTotals": [64],
|
910
914
|
"executeSearch": [64],
|
911
915
|
"executePreparedSearch": [64],
|
@@ -17,6 +17,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
17
17
|
this._permissions = undefined;
|
18
18
|
this.showActionButtons = false;
|
19
19
|
this.configName = undefined;
|
20
|
+
this.resourceID = undefined;
|
20
21
|
this.viewMode = VIEW_MODE.GRID;
|
21
22
|
this.messagesBuilder = undefined;
|
22
23
|
}
|
@@ -81,7 +82,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
81
82
|
componentWillLoad() {
|
82
83
|
this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
|
83
84
|
if (this._application) {
|
84
|
-
this._application.getAllAccess().then(access => (this._permissions = access));
|
85
|
+
this._application.getAllAccess(this.resourceID).then(access => (this._permissions = access));
|
85
86
|
}
|
86
87
|
else {
|
87
88
|
this._permissions = {};
|
@@ -94,6 +95,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
94
95
|
}, [6, "snk-configurator", {
|
95
96
|
"showActionButtons": [4, "show-action-buttons"],
|
96
97
|
"configName": [1, "config-name"],
|
98
|
+
"resourceID": [1, "resource-i-d"],
|
97
99
|
"viewMode": [2, "view-mode"],
|
98
100
|
"messagesBuilder": [1040],
|
99
101
|
"_opened": [32],
|
@@ -51,6 +51,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
51
51
|
this.attachmentRegisterKey = undefined;
|
52
52
|
this._currentViewMode = VIEW_MODE.GRID;
|
53
53
|
this._canEdit = undefined;
|
54
|
+
this._resourceID = undefined;
|
54
55
|
this.configName = undefined;
|
55
56
|
this.selectionToastConfig = undefined;
|
56
57
|
this.showActionButtons = false;
|
@@ -145,7 +146,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
145
146
|
}
|
146
147
|
componentWillLoad() {
|
147
148
|
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
148
|
-
application.hasAccess(AutorizationType.UPDATE).then(canEdit => this._canEdit = canEdit);
|
149
|
+
application.hasAccess(AutorizationType.UPDATE, this._resourceID).then(canEdit => this._canEdit = canEdit);
|
149
150
|
let parent = this._element.parentElement;
|
150
151
|
while (parent) {
|
151
152
|
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
@@ -157,11 +158,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
157
158
|
if (!this._dataUnit) {
|
158
159
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
159
160
|
this._dataUnit = evt.detail;
|
160
|
-
this.initDataUnit();
|
161
|
+
this.initDataUnit(application);
|
161
162
|
});
|
162
163
|
}
|
163
164
|
else {
|
164
|
-
this.initDataUnit();
|
165
|
+
this.initDataUnit(application);
|
165
166
|
}
|
166
167
|
this._snkDataUnit.addEventListener("dataStateChange", async ({ detail: dataState }) => {
|
167
168
|
this._dataState = dataState;
|
@@ -177,11 +178,18 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
177
178
|
this.configName = application.configName;
|
178
179
|
}
|
179
180
|
}
|
180
|
-
initDataUnit() {
|
181
|
+
async initDataUnit(application) {
|
181
182
|
this.addDataElementID();
|
182
183
|
if (!this.messagesBuilder) {
|
183
184
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
184
185
|
}
|
186
|
+
if (this._resourceID == undefined) {
|
187
|
+
//Tenta pegar o resourceID do snkDataUnit;
|
188
|
+
this._resourceID = this._snkDataUnit.resourceID;
|
189
|
+
if (this._resourceID == undefined) {
|
190
|
+
this._resourceID = await application.getResourceID();
|
191
|
+
}
|
192
|
+
}
|
185
193
|
}
|
186
194
|
handleConfiguratorEvent(evt, type) {
|
187
195
|
evt.stopImmediatePropagation();
|
@@ -192,8 +200,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
192
200
|
this.configuratorCancel.emit();
|
193
201
|
}
|
194
202
|
render() {
|
203
|
+
if (this._resourceID == undefined) {
|
204
|
+
return;
|
205
|
+
}
|
195
206
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
196
|
-
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, 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 }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(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 }, h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), 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') }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
|
207
|
+
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, 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 }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(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 }, h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), 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 }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
|
197
208
|
}
|
198
209
|
get _element() { return this; }
|
199
210
|
static get watchers() { return {
|
@@ -217,6 +228,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
217
228
|
"attachmentRegisterKey": [32],
|
218
229
|
"_currentViewMode": [32],
|
219
230
|
"_canEdit": [32],
|
231
|
+
"_resourceID": [32],
|
220
232
|
"goToView": [64],
|
221
233
|
"openConfigurator": [64],
|
222
234
|
"closeConfigurator": [64],
|
@@ -71,6 +71,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
71
71
|
this.useCancelConfirm = true;
|
72
72
|
this.ignoreSaveMessage = undefined;
|
73
73
|
this.configName = undefined;
|
74
|
+
this.resourceID = undefined;
|
74
75
|
}
|
75
76
|
observePageSize() {
|
76
77
|
if (this.dataUnit) {
|
@@ -334,10 +335,10 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
334
335
|
const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
|
335
336
|
if (this._parentSnkDataUnit) {
|
336
337
|
this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
|
337
|
-
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName);
|
338
|
+
return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID);
|
338
339
|
}
|
339
340
|
else {
|
340
|
-
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName);
|
341
|
+
return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
|
341
342
|
}
|
342
343
|
}
|
343
344
|
async loadDataUnit() {
|
@@ -396,7 +397,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
396
397
|
//---------------------------------------------
|
397
398
|
componentWillLoad() {
|
398
399
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
399
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
400
|
+
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
400
401
|
this._parentSnkDataUnit = this.getParentSnkDataUnit();
|
401
402
|
if (this.messagesBuilder == undefined) {
|
402
403
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
@@ -436,6 +437,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
436
437
|
"useCancelConfirm": [4, "use-cancel-confirm"],
|
437
438
|
"ignoreSaveMessage": [4, "ignore-save-message"],
|
438
439
|
"configName": [1, "config-name"],
|
440
|
+
"resourceID": [1, "resource-i-d"],
|
439
441
|
"getDataUnit": [64],
|
440
442
|
"getSelectedRecordsIDsInfo": [64]
|
441
443
|
}]);
|
@@ -61,6 +61,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
61
61
|
this.messagesBuilder = undefined;
|
62
62
|
this.canEdit = true;
|
63
63
|
this.presentationMode = undefined;
|
64
|
+
this.resourceID = undefined;
|
64
65
|
this._breadcrumbItems = [];
|
65
66
|
this._guides = undefined;
|
66
67
|
this._formEditorConfigManager = undefined;
|
@@ -262,7 +263,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
262
263
|
else {
|
263
264
|
detailBranch = this.selectedGuide;
|
264
265
|
}
|
265
|
-
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail) }));
|
266
|
+
content = this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID }));
|
266
267
|
}
|
267
268
|
else {
|
268
269
|
const cardId = this.selectedGuide.id;
|
@@ -311,7 +312,10 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
311
312
|
return this.selectedGuide === undefined || '__main' === ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id);
|
312
313
|
}
|
313
314
|
componentWillLoad() {
|
314
|
-
|
315
|
+
if (this.resourceID == undefined) {
|
316
|
+
throw new Error("Erro interno: resourceID não informado");
|
317
|
+
}
|
318
|
+
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, config => this.masterFormConfig = config);
|
315
319
|
this._configManager.loadConfig();
|
316
320
|
}
|
317
321
|
componentDidRender() {
|
@@ -330,7 +334,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
330
334
|
}
|
331
335
|
buildTaskBar() {
|
332
336
|
var _a;
|
333
|
-
return h("div", { class: `ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 ${this.presentationMode != PresentationMode.SECONDARY ? 'ez-align--right' : 'ez-padding-bottom--medium'}` }, h("snk-taskbar", { key: "guideViewerTaskbar", "data-element-id": "guideViewer", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, messagesBuilder: this.messagesBuilder, presentationMode: this.presentationMode, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-taskbar-owner": "master", dataUnit: this.dataUnit }));
|
337
|
+
return h("div", { class: `ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 ${this.presentationMode != PresentationMode.SECONDARY ? 'ez-align--right' : 'ez-padding-bottom--medium'}` }, h("snk-taskbar", { key: "guideViewerTaskbar", "data-element-id": "guideViewer", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, messagesBuilder: this.messagesBuilder, presentationMode: this.presentationMode, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-taskbar-owner": "master", dataUnit: this.dataUnit, resourceID: this.resourceID }));
|
334
338
|
}
|
335
339
|
render() {
|
336
340
|
var _a, _b;
|
@@ -349,7 +353,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
349
353
|
h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
|
350
354
|
h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
|
351
355
|
:
|
352
|
-
h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms(this.masterFormConfig, this._masterFormMetadata, (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id, this.dataUnit, this.recordsValidator), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
356
|
+
h("div", null), h("div", { class: "snk-guides-viewer__detail-container" }, SnkGuidesViewer.buildFixedForms(this.masterFormConfig, this._masterFormMetadata, (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id, this.dataUnit, this.recordsValidator), this.getContent())), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
|
353
357
|
}
|
354
358
|
static get watchers() { return {
|
355
359
|
"dataUnit": ["observeDataUnit"],
|
@@ -358,7 +362,6 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
358
362
|
}; }
|
359
363
|
static get style() { return snkGuidesViewerCss; }
|
360
364
|
}, [2, "snk-guides-viewer", {
|
361
|
-
"_guideBuilders": [16],
|
362
365
|
"dataUnit": [16],
|
363
366
|
"dataState": [16],
|
364
367
|
"configName": [1, "config-name"],
|
@@ -371,6 +374,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
371
374
|
"messagesBuilder": [1040],
|
372
375
|
"canEdit": [4, "can-edit"],
|
373
376
|
"presentationMode": [1, "presentation-mode"],
|
377
|
+
"resourceID": [1, "resource-i-d"],
|
374
378
|
"_breadcrumbItems": [32],
|
375
379
|
"_guides": [32],
|
376
380
|
"_formEditorConfigManager": [32],
|
@@ -593,6 +597,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
593
597
|
this.attachmentRegisterKey = undefined;
|
594
598
|
this.formConfigManager = undefined;
|
595
599
|
this.dataUnitName = undefined;
|
600
|
+
this.resourceID = undefined;
|
596
601
|
this.guideItemPath = undefined;
|
597
602
|
this.entityName = undefined;
|
598
603
|
this.label = undefined;
|
@@ -762,7 +767,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
762
767
|
}
|
763
768
|
componentWillLoad() {
|
764
769
|
this._configName = `dynaform.${this.entityName}`;
|
765
|
-
this.formConfigManager = new SnkFormConfigManager(this._configName, () => this.loadMetadata());
|
770
|
+
this.formConfigManager = new SnkFormConfigManager(this._configName, this.resourceID, () => this.loadMetadata());
|
766
771
|
this.formConfigManager.loadConfig();
|
767
772
|
if (this.messagesBuilder == undefined) {
|
768
773
|
this.messagesBuilder = new SnkMessageBuilder(this.entityName);
|
@@ -771,7 +776,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
771
776
|
render() {
|
772
777
|
this.updateLabel();
|
773
778
|
//const cardConfig: IFormCardConfig = this._cardsState?.get(this.selectedForm);
|
774
|
-
return (h(Host, null, 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 === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-flex ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), 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(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: PresentationMode.SECONDARY, canEdit: this.canEdit, isDetail: true }))), h("stack-item", null, 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) }, 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: PresentationMode.SECONDARY, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
|
779
|
+
return (h(Host, null, 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 === VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, h("ez-view-stack", { ref: (ref) => this.updateViewStack(ref) }, h("stack-item", null, h("div", { class: "ez-box ez-box--shadow grid-container" }, h("div", { class: "ez-flex ez-title--primary ez-size-width--full ez-padding--large detail-header" }, h("div", { class: "ez-flex ez-text ez-text--bold ez-flex--justify-start ez-flex--align-items-center" }, this._levelPath ? h("span", { class: "level-path" }, this._levelPath + " /") : undefined, this.label)), 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(VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: PresentationMode.SECONDARY, canEdit: this.canEdit, isDetail: true }))), h("stack-item", null, 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) }, 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: PresentationMode.SECONDARY, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this.entityName, onBack: this.handleAttachBack.bind(this) }))))));
|
775
780
|
}
|
776
781
|
static get watchers() { return {
|
777
782
|
"dataState": ["observerDataState"]
|
@@ -780,6 +785,7 @@ const SnkDetailView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
780
785
|
}, [2, "snk-detail-view", {
|
781
786
|
"formConfigManager": [1040],
|
782
787
|
"dataUnitName": [1, "data-unit-name"],
|
788
|
+
"resourceID": [1, "resource-i-d"],
|
783
789
|
"guideItemPath": [16],
|
784
790
|
"entityName": [1, "entity-name"],
|
785
791
|
"label": [1],
|
@@ -8,7 +8,6 @@ const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
8
8
|
super();
|
9
9
|
this.__registerHost();
|
10
10
|
this.valueChanged = createEvent(this, "valueChanged", 7);
|
11
|
-
this.saveConfig = createEvent(this, "saveConfig", 7);
|
12
11
|
this._searchValue = undefined;
|
13
12
|
this._ezListSource = [];
|
14
13
|
this.config = undefined;
|
@@ -17,7 +16,6 @@ const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
17
16
|
}
|
18
17
|
async reloadList() {
|
19
18
|
this.loadListSource();
|
20
|
-
this.saveConfig.emit(this.config);
|
21
19
|
}
|
22
20
|
observeConfig() {
|
23
21
|
var _a, _b;
|
@@ -33,7 +31,6 @@ const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
33
31
|
}
|
34
32
|
});
|
35
33
|
this.config = ObjectUtils.copy(configCopy);
|
36
|
-
this.saveConfig.emit(this.config);
|
37
34
|
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
38
35
|
}
|
39
36
|
loadListSource() {
|
@@ -90,7 +87,6 @@ const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
90
87
|
}
|
91
88
|
] });
|
92
89
|
this.loadListSource();
|
93
|
-
this.saveConfig.emit(this.config);
|
94
90
|
this.valueChanged.emit((_d = this.config) === null || _d === void 0 ? void 0 : _d.value);
|
95
91
|
}
|
96
92
|
}
|
@@ -208,6 +208,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
208
208
|
};
|
209
209
|
this.dataUnit = undefined;
|
210
210
|
this.configName = undefined;
|
211
|
+
this.resourceID = undefined;
|
211
212
|
this.filterConfig = undefined;
|
212
213
|
this.messagesBuilder = undefined;
|
213
214
|
this.allowDefault = undefined;
|
@@ -287,7 +288,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
287
288
|
}
|
288
289
|
if (this._configUpdated) {
|
289
290
|
this._configUpdated = false;
|
290
|
-
ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName);
|
291
|
+
ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
|
291
292
|
}
|
292
293
|
}
|
293
294
|
/**
|
@@ -403,15 +404,13 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
403
404
|
}
|
404
405
|
loadConfigFromStorage() {
|
405
406
|
return new Promise(accept => {
|
406
|
-
ConfigStorage.
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
414
|
-
});
|
407
|
+
ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
|
408
|
+
.then((filters) => {
|
409
|
+
accept();
|
410
|
+
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
411
|
+
})
|
412
|
+
.catch(reason => {
|
413
|
+
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
415
414
|
});
|
416
415
|
});
|
417
416
|
}
|
@@ -496,7 +495,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
496
495
|
return undefined;
|
497
496
|
}
|
498
497
|
if (this.showPersonalizedFilter) {
|
499
|
-
return 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 });
|
498
|
+
return 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
499
|
}
|
501
500
|
return (h(Host, null, h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
502
501
|
}
|
@@ -508,6 +507,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
508
507
|
}, [2, "snk-filter-bar", {
|
509
508
|
"dataUnit": [1040],
|
510
509
|
"configName": [1, "config-name"],
|
510
|
+
"resourceID": [1, "resource-i-d"],
|
511
511
|
"filterConfig": [1040],
|
512
512
|
"messagesBuilder": [1040],
|
513
513
|
"allowDefault": [32],
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
2
2
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum.js';
|
4
|
-
import {
|
5
|
-
import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher.js';
|
4
|
+
import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
|
6
5
|
import { E as EPresentationMode } from './presentationMode.js';
|
7
6
|
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
|
8
7
|
|
@@ -28,7 +27,6 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
28
27
|
}
|
29
28
|
componentDidLoad() {
|
30
29
|
if (this._element) {
|
31
|
-
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
32
30
|
ElementIDUtils.addIDInfo(this._element);
|
33
31
|
const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
34
32
|
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
@@ -146,20 +144,12 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
146
144
|
this.config = ObjectUtils.copy(configCopy);
|
147
145
|
}
|
148
146
|
}
|
149
|
-
saveConfig(newConfig) {
|
150
|
-
var _a;
|
151
|
-
(_a = this._application) === null || _a === void 0 ? void 0 : _a.getResourceID().then(resourceId => {
|
152
|
-
const fetcher = new FilterBarConfigFetcher();
|
153
|
-
fetcher.saveEntityListConfig(newConfig, resourceId, this._application.configName);
|
154
|
-
this.config = newConfig;
|
155
|
-
});
|
156
|
-
}
|
157
147
|
componentWillLoad() {
|
158
148
|
this.originalConfig = ObjectUtils.copy(this.config);
|
159
149
|
}
|
160
150
|
render() {
|
161
151
|
const { tag: CustomElement, props } = this.getContentEditor();
|
162
|
-
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(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,
|
152
|
+
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(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)), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
163
153
|
}
|
164
154
|
get _element() { return this; }
|
165
155
|
static get watchers() { return {
|